diff --git a/sale_order.py b/sale_order.py index 549ef2b..0ca3aed 100644 --- a/sale_order.py +++ b/sale_order.py @@ -23,6 +23,13 @@ class SaleOrder(ModelView, ModelSQL): [("on_site", "On Site"), ("at_home", "At Home")], 'Pickup Location' ) + order_adress = fields.Many2One( + 'party.address', 'Address' + ) + order_mobile = fields.Function( + fields.Char('Mobile'), + 'on_change_with_order_mobile' + ) lines = fields.One2Many( 'order.line', 'order', 'Lines' ) @@ -63,6 +70,19 @@ class SaleOrder(ModelView, ModelSQL): if company: return Company(company).currency.id + @fields.depends('party') + def on_change_with_order_mobile(self, name=None): + if self.party: + pool = Pool() + ContactMechanism = pool.get('party.contact_mechanism') + mechanisms = ContactMechanism.search([ + ('party', '=', self.party.id), + ('type', '=', 'mobile') + ]) + if mechanisms: + return mechanisms[0].value + return None + class OrderLine(ModelView, ModelSQL): "Order Line" diff --git a/view/line_tree.xml b/view/line_tree.xml index c1fc90f..07a2a31 100644 --- a/view/line_tree.xml +++ b/view/line_tree.xml @@ -5,5 +5,5 @@ this repository contains the full copyright notices and license terms. --> - + \ No newline at end of file diff --git a/view/order_form.xml b/view/order_form.xml index 437cb90..d11858d 100644 --- a/view/order_form.xml +++ b/view/order_form.xml @@ -6,6 +6,10 @@ this repository contains the full copyright notices and license terms. -->