Added supplier and contact address on supplier packing
This commit is contained in:
1 parent
a51698af79
commit
e1e5c5e2f5
2 files changed
+28
-2
No files matched your search
+17
@@ -19,6 +19,13 @@ class PackingIn(OSV):
|
||||
|
||||
effective_date =fields.DateTime('Effective Date', readonly=True)
|
||||
planned_date = fields.DateTime('Planned Date', readonly=True)
|
||||
supplier = fields.Many2One(
|
||||
'partner.partner', 'Supplier',
|
||||
states={'readonly': "state != 'draft'",}, on_change=['supplier',])
|
||||
contact_address = fields.Many2One(
|
||||
'partner.address', 'Contact Address',
|
||||
states={'readonly': "state != 'draft'",},
|
||||
domain="[('partner', '=', supplier)]")
|
||||
warehouse = fields.Many2One('stock.location', "Warehouse",
|
||||
required=True, states=STATES, domain="[('type', '=', 'warehouse')]")
|
||||
incoming_moves = fields.Function('get_incoming_moves', type='one2many',
|
||||
@@ -55,6 +62,14 @@ class PackingIn(OSV):
|
||||
def default_state(self, cursor, user, context=None):
|
||||
return 'draft'
|
||||
|
||||
def on_change_supplier(self, cursor, user, ids, values, context=None):
|
||||
if not values.get('supplier'):
|
||||
return {}
|
||||
partner_obj = self.pool.get("partner.partner")
|
||||
address_id = partner_obj.address_get(cursor, user, values['supplier'],
|
||||
context=context)
|
||||
return {'contact_address': address_id}
|
||||
|
||||
def get_incoming_moves(self, cursor, user, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for packing in self.browse(cursor, user, ids, context=context):
|
||||
@@ -593,6 +608,8 @@ class PackingOut(OSV):
|
||||
workflow_service = LocalService('workflow')
|
||||
for packing in self.browse(cursor, user, ids, context=context):
|
||||
workflow_service.trg_create(user, self._name, packing.id, cursor)
|
||||
self.write(
|
||||
cursor, user, packing.id, {'state':'draft'}, context=context)
|
||||
|
||||
PackingOut()
|
||||
|
||||
|
||||
+11
-2
@@ -36,8 +36,14 @@
|
||||
<form string="Supplier Packing" col="6">
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
<label name="supplier"/>
|
||||
<field name="supplier"/>
|
||||
<label name="contact_address"/>
|
||||
<field name="contact_address"/>
|
||||
<label name="warehouse"/>
|
||||
<field name="warehouse"/>
|
||||
<label name="planned_date"/>
|
||||
<field name="planned_date"/>
|
||||
<label name="effective_date"/>
|
||||
<field name="effective_date"/>
|
||||
<label colspan="4"/>
|
||||
@@ -91,7 +97,10 @@
|
||||
<tree string="Supplier Packings">
|
||||
<field name="code" select="1"/>
|
||||
<field name="state" select="1"/>
|
||||
<field name="planned_date" select="2"/>
|
||||
<field name="effective_date" select="2"/>
|
||||
<field name="supplier" select="2"/>
|
||||
<field name="contact_address" select="2"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
@@ -242,7 +251,8 @@
|
||||
<field name="state" select="1"/>
|
||||
<field name="planned_date" select="2"/>
|
||||
<field name="effective_date" select="2"/>
|
||||
<field name="customer_address"/>
|
||||
<field name="customer"/>
|
||||
<field name="delivery_address"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
@@ -551,6 +561,5 @@
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
Reference in new issue
Block a user