From 99d616bc43d73f838de43b73b17e1708dde2fb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 May 2008 12:21:56 +0200 Subject: [PATCH 1/3] Add location properties on partner and fix indent --- location.py | 22 +++++++++++++++++++++- location.xml | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/location.py b/location.py index 9b0e5484ea..7199a21bac 100644 --- a/location.py +++ b/location.py @@ -8,6 +8,8 @@ STATES_WH = { 'invisible': "type != 'warehouse'", 'readonly': "not active", } + + class Location(OSV): "Stock Location" _name = 'stock.location' @@ -49,7 +51,7 @@ class Location(OSV): return True def default_type(self, cursor, user, context=None): - return 'storage' + return 'storage' def name_search(self, cursor, user, name, args=None, operator='ilike', context=None, limit=None): @@ -66,3 +68,21 @@ class Location(OSV): return result Location() + + +class Partner(OSV): + _name = 'partner.partner' + supplier_location = fields.Property(type='many2one', + relation='stock.location', string='Supplier Location', + group_name='Stock Properties', view_load=True, + domain=[('type', '=', 'supplier')], + help='The default source location ' \ + 'when receiving products from the partner.') + customer_location = fields.Property(type='many2one', + relation='stock.location', string='Customer Location', + group_name='Stock Properties', view_load=True, + domain=[('type', '=', 'customer')], + help='The default destination location ' \ + 'when sending products to the partner.') + +Partner() diff --git a/location.xml b/location.xml index 5711cddb9d..a8edd805ed 100644 --- a/location.xml +++ b/location.xml @@ -160,6 +160,28 @@ + + Supplier + SUP + supplier + + + Customer + CUS + customer + + + supplier_location + + + + + customer_location + + + From 978487034a0d552f5e89e7a2a43e18d5a03a893b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 May 2008 13:12:57 +0200 Subject: [PATCH 2/3] Fix indent and select args must be numeric (1 or 2) --- move.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/move.py b/move.py index ec32479395..883be56459 100644 --- a/move.py +++ b/move.py @@ -7,40 +7,44 @@ STATES = { 'readonly': "(state in ('cancel', 'done'))", } + class Move(OSV): "Stock Move" _name = 'stock.move' _description = __doc__ _rec_name = "product" product = fields.Many2One( - "product.product", "Product", required=True, select=True, states=STATES, + "product.product", "Product", required=True, select=1, states=STATES, on_change=['product']) uom = fields.Many2One("product.uom", "Uom", required=True, states=STATES,) quantity = fields.Float( "Quantity", digits=(12, 6), required=True, states=STATES,) from_location = fields.Many2One( - "stock.location", "From Location", select=True, required=True, + "stock.location", "From Location", select=1, required=True, states=STATES, domain="[('type', '!=', 'warehouse')]",) to_location = fields.Many2One( - "stock.location", "To Location", select=True, required=True, + "stock.location", "To Location", select=1, required=True, states=STATES, domain="[('type', '!=', 'warehouse')]",) incoming_packing_in = fields.Many2One( - "stock.packing.in", "Supplier Packing", states=STATES, select=True) + "stock.packing.in", "Supplier Packing", states=STATES, select=1) inventory_packing_in = fields.Many2One( "stock.packing.in", "Inventory Supplier Packing", states=STATES, - select=True) + select=1) outgoing_packing_out = fields.Many2One( - "stock.packing.out", "Customer Packing", states=STATES, select=True) + "stock.packing.out", "Customer Packing", states=STATES, select=1) inventory_packing_out = fields.Many2One( "stock.packing.out", "Inventory Customer Packing", states=STATES, - select=True) + select=1) planned_date = fields.Date("Planned Date", states=STATES,) effective_date = fields.Date("Effective Date", readonly=True) - state = fields.Selection( - [('draft', 'Draft'), ('done', 'Done'), ('cancel', 'Cancel'), - ('waiting', 'Waiting'), ('assigned', 'Assigned')], 'State', select=True, readonly=True) - + state = fields.Selection([ + ('draft', 'Draft'), + ('done', 'Done'), + ('cancel', 'Cancel'), + ('waiting', 'Waiting'), + ('assigned', 'Assigned'), + ], 'State', select=1, readonly=True) def __init__(self): super(Move, self).__init__() @@ -191,8 +195,10 @@ Move() class CreatePackingWarn(WizardOSV): _name = 'stock.move.create_packing.warn' + CreatePackingWarn() + class CreatePacking(Wizard): 'Create Packing' _name = 'stock.move.create_packing' @@ -202,10 +208,11 @@ class CreatePacking(Wizard): 'type': 'action', 'action': '_create', 'state': 'end', - }, }, + }, + + } - } def _create(self, cursor, user, data, context=None): move_obj = self.pool.get('stock.move') From 5136ea3fda31849a6344f67aa1d87f7a15922369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 May 2008 20:24:09 +0200 Subject: [PATCH 3/3] Fix intend --- packing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/packing.py b/packing.py index a0aad12a14..62111e0f00 100644 --- a/packing.py +++ b/packing.py @@ -7,6 +7,7 @@ STATES = { 'readonly': "state in ('cancel', 'done')", } + class PackingIn(OSV): "Supplier Packing" _name = 'stock.packing.in'