Add company on move
This commit is contained in:
1 parent
4ddab245a8
commit
b2ac57f74e
3 files changed
+33
-3
No files matched your search
+5
-1
@@ -7,7 +7,11 @@
|
||||
'category': 'Generic Modules',
|
||||
'description': 'Stock Management and Inventory Control',
|
||||
'depends': [
|
||||
'partner', 'product'
|
||||
'ir',
|
||||
'workflow',
|
||||
'partner',
|
||||
'product',
|
||||
'company',
|
||||
],
|
||||
'xml': [
|
||||
'product.xml',
|
||||
|
||||
@@ -39,6 +39,10 @@ class Move(OSV):
|
||||
('waiting', 'Waiting'),
|
||||
('assigned', 'Assigned'),
|
||||
], 'State', select=1, readonly=True)
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
states={
|
||||
'readonly': "state != 'draft'",
|
||||
})
|
||||
|
||||
def __init__(self):
|
||||
super(Move, self).__init__()
|
||||
@@ -103,6 +107,15 @@ class Move(OSV):
|
||||
return 'done'
|
||||
return 'draft'
|
||||
|
||||
def default_company(self, cursor, user, context=None):
|
||||
company_obj = self.pool.get('company.company')
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('company'):
|
||||
return company_obj.name_get(cursor, user, context['company'],
|
||||
context=context)[0]
|
||||
return False
|
||||
|
||||
def on_change_product(self, cursor, user, ids, value, context=None):
|
||||
if 'product' in value and value['product']:
|
||||
product = self.pool.get('product.product').browse(
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<field name="planned_date"/>
|
||||
<label name="effective_date"/>
|
||||
<field name="effective_date"/>
|
||||
<newline/>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<separator colspan="6"/>
|
||||
<group col="4" colspan="6">
|
||||
<label name="state"/>
|
||||
@@ -134,8 +137,7 @@
|
||||
<field name="name">Moves to customers</field>
|
||||
<field name="res_model">stock.move</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">
|
||||
[('to_location.type', '=', 'customer')]</field>
|
||||
<field name="domain">[('to_location.type', '=', 'customer')]</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_move_form_cust_view1">
|
||||
@@ -151,5 +153,16 @@
|
||||
</record>
|
||||
<menuitem parent="menu_move_form" sequence="3"
|
||||
action="act_move_form_cust" id="menu_move_form_cust"/>
|
||||
|
||||
<record model="ir.rule.group" id="rule_group_move">
|
||||
<field name="model" search="[('model', '=', 'stock.move')]"/>
|
||||
<field name="global_p" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.rule" id="rule_move">
|
||||
<field name="field" search="[('name', '=', 'company'), ('model.model', '=', 'stock.move')]"/>
|
||||
<field name="operator">=</field>
|
||||
<field name="operand">User/Current Company</field>
|
||||
<field name="rule_group" ref="rule_group_move"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
Reference in new issue
Block a user