Fix: Add fields adress mobile

This commit is contained in:
cosmos 2025-02-02 12:42:34 -05:00
parent 9237671048
commit 394364de81
4 changed files with 29 additions and 4 deletions

View File

@ -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"

View File

@ -5,5 +5,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="product"/>
<field name="quantity"/>
<field name="unitprice"/>
<field name="total_amount"/>
<field name="total_amount" />
</tree>

View File

@ -6,6 +6,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="party"/>
<label name="pickup_location"/>
<field name="pickup_location"/>
<label name="order_adress"/>
<field name="order_adress"/>
<label name="order_mobile"/>
<field name="order_mobile"/>
<label name="date"/>
<field name="date"/>
<field name="lines" colspan="4"

View File

@ -1,8 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree keyword_open="1">
<field name="party"/>
<tree>
<field name="party" />
<field name="pickup_location"/>
<field name="date"/>
<field name="date" />
<field name="total_order" width="200" />
</tree>