コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
2636 ビュー

Hello,


On an order/invoice, i select a customer and at the shipping address it displays all of the contacts on record. I want to display only the contacts and addresses of the customer I've selected.


Thank you.


アバター
破棄
最善の回答

Hi,
You can achieve this by adding domain for the contact field of sale order.If you want to set whether a contact need to be shown in the shipping address in the contact form, add a boolean field inside contact form and show only those contact for which this boolean is enabled.For example if the boolean field is

test_boolean = fields.Boolean()

Then the domain will be [('test_boolean', '=', True)]

Regards

アバター
破棄

This will show all the delivery addresses for all the companies. i have tried to filter it out with ["parent_id","=","partner_id"] but then doesnt populate anything

最善の回答

Inherit the field and add ('parent_id','=',partner_id) to the domain:

class SaleOrder(models.Model):
_inherit = 'sale.order'

partner_shipping_id = fields.Many2one(
comodel_name='res.partner',
string="Delivery Address",
compute='_compute_partner_shipping_id',
store=True, readonly=False, required=True, precompute=True,
states=LOCKED_FIELD_STATES,
domain="['|','&',('company_id', '=', False), ('company_id', '=', company_id), ('parent_id','=',partner_id)]")

アバター
破棄