Remove purchase fields from stock move
issue8254 review265251002
This commit is contained in:
1 parent
50132daa0c
commit
f70595e0a2
4 files changed
+4
-89
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Remove purchase fields from stock move
|
||||
* Remove starting wildcard when searching on codes and numbers
|
||||
* Allow product supplier to be defined on variants
|
||||
|
||||
|
||||
@@ -532,12 +532,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">template_tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="move_view_form">
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit" ref="stock.move_view_form"/>
|
||||
<field name="name">move_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.wizard" id="act_open_supplier">
|
||||
<field name="name">Parties associated to Purchases</field>
|
||||
<field name="wiz_name">purchase.open_supplier</field>
|
||||
|
||||
@@ -13,8 +13,6 @@ from trytond.pyson import Eval
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
from trytond.modules.product import price_digits
|
||||
|
||||
__all__ = ['ShipmentIn', 'ShipmentInReturn', 'Move', 'Location']
|
||||
|
||||
|
||||
@@ -154,35 +152,9 @@ def process_purchase_move(func):
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
__name__ = 'stock.move'
|
||||
purchase = fields.Function(fields.Many2One('purchase.purchase', 'Purchase',
|
||||
states={
|
||||
'invisible': ~Eval('purchase_visible', False),
|
||||
},
|
||||
depends=['purchase_visible']), 'get_purchase',
|
||||
searcher='search_purchase')
|
||||
purchase_quantity = fields.Function(fields.Float('Purchase Quantity',
|
||||
digits=(16, Eval('unit_digits', 2)),
|
||||
states={
|
||||
'invisible': ~Eval('purchase_visible', False),
|
||||
},
|
||||
depends=['purchase_visible', 'unit_digits']),
|
||||
'get_purchase_fields')
|
||||
purchase_unit = fields.Function(fields.Many2One('product.uom',
|
||||
'Purchase Unit', states={
|
||||
'invisible': ~Eval('purchase_visible', False),
|
||||
}, depends=['purchase_visible']), 'get_purchase_fields')
|
||||
purchase_unit_digits = fields.Function(fields.Integer(
|
||||
'Purchase Unit Digits'), 'get_purchase_fields')
|
||||
purchase_unit_price = fields.Function(fields.Numeric('Purchase Unit Price',
|
||||
digits=price_digits, states={
|
||||
'invisible': ~Eval('purchase_visible', False),
|
||||
}, depends=['purchase_visible']), 'get_purchase_fields')
|
||||
purchase_currency = fields.Function(fields.Many2One('currency.currency',
|
||||
'Purchase Currency', states={
|
||||
'invisible': ~Eval('purchase_visible', False),
|
||||
}, depends=['purchase_visible']), 'get_purchase_fields')
|
||||
purchase_visible = fields.Function(fields.Boolean('Purchase Visible'),
|
||||
'on_change_with_purchase_visible')
|
||||
purchase = fields.Function(
|
||||
fields.Many2One('purchase.purchase', 'Purchase'),
|
||||
'get_purchase', searcher='search_purchase')
|
||||
supplier = fields.Function(fields.Many2One('party.party', 'Supplier'),
|
||||
'get_supplier', searcher='search_supplier')
|
||||
purchase_exception_state = fields.Function(fields.Selection([
|
||||
@@ -222,33 +194,6 @@ class Move(metaclass=PoolMeta):
|
||||
if self in self.origin.moves_ignored:
|
||||
return 'ignored'
|
||||
|
||||
def get_purchase_fields(self, name):
|
||||
PurchaseLine = Pool().get('purchase.line')
|
||||
if isinstance(self.origin, PurchaseLine):
|
||||
if name[9:] == 'currency':
|
||||
return self.origin.purchase.currency.id
|
||||
elif name[9:] in ('quantity', 'unit_digits', 'unit_price'):
|
||||
return getattr(self.origin, name[9:])
|
||||
else:
|
||||
return getattr(self.origin, name[9:]).id
|
||||
else:
|
||||
if name[9:] == 'quantity':
|
||||
return 0.0
|
||||
elif name[9:] == 'unit_digits':
|
||||
return 2
|
||||
|
||||
@fields.depends('from_location', 'to_location')
|
||||
def on_change_with_purchase_visible(self, name=None):
|
||||
if self.from_location:
|
||||
if self.from_location.type == 'supplier':
|
||||
if self.to_location and self.to_location == 'supplier':
|
||||
return False
|
||||
return True
|
||||
elif self.to_location:
|
||||
if self.to_location.type == 'supplier':
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_supplier(self, name):
|
||||
PurchaseLine = Pool().get('purchase.line')
|
||||
if isinstance(self.origin, PurchaseLine):
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?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. -->
|
||||
<data>
|
||||
<xpath expr="/form/field[@name='uom']" position="after">
|
||||
<label name="purchase_quantity"/>
|
||||
<field name="purchase_quantity"/>
|
||||
<label name="purchase_unit"/>
|
||||
<field name="purchase_unit"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/field[@name='currency']" position="after">
|
||||
<label name="purchase_unit_price"/>
|
||||
<field name="purchase_unit_price"/>
|
||||
<label name="purchase_currency"/>
|
||||
<field name="purchase_currency"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/field[@name='effective_date']" position="after">
|
||||
<label name="purchase"/>
|
||||
<field name="purchase"/>
|
||||
<newline/>
|
||||
</xpath>
|
||||
<xpath expr="/form/field[@name='unit_digits']" position="after">
|
||||
<field name="purchase_unit_digits" invisible="1" colspan="4"/>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in new issue
Block a user