From f70595e0a237f6c3b8b4068e430c823c8b3203cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 11 Apr 2019 19:57:25 +0200 Subject: [PATCH] Remove purchase fields from stock move issue8254 review265251002 --- CHANGELOG | 1 + purchase.xml | 6 ----- stock.py | 61 +++------------------------------------------- view/move_form.xml | 25 ------------------- 4 files changed, 4 insertions(+), 89 deletions(-) delete mode 100644 view/move_form.xml diff --git a/CHANGELOG b/CHANGELOG index d1668fd5a7..3e88327583 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/purchase.xml b/purchase.xml index 430ee733e4..f9202f0714 100644 --- a/purchase.xml +++ b/purchase.xml @@ -532,12 +532,6 @@ this repository contains the full copyright notices and license terms. --> template_tree - - stock.move - - move_form - - Parties associated to Purchases purchase.open_supplier diff --git a/stock.py b/stock.py index 529c13cb7a..feb9d05b11 100644 --- a/stock.py +++ b/stock.py @@ -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): diff --git a/view/move_form.xml b/view/move_form.xml deleted file mode 100644 index aaf6709f64..0000000000 --- a/view/move_form.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - -