diff --git a/CHANGELOG b/CHANGELOG old mode 100755 new mode 100644 diff --git a/COPYRIGHT b/COPYRIGHT old mode 100755 new mode 100644 diff --git a/INSTALL b/INSTALL old mode 100755 new mode 100644 diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/MANIFEST.in b/MANIFEST.in old mode 100755 new mode 100644 diff --git a/README b/README old mode 100755 new mode 100644 diff --git a/TODO b/TODO old mode 100755 new mode 100644 diff --git a/__init__.py b/__init__.py old mode 100755 new mode 100644 diff --git a/locale/ca_ES.po b/locale/ca_ES.po old mode 100755 new mode 100644 index 40a1b38..f7ee2a9 --- a/locale/ca_ES.po +++ b/locale/ca_ES.po @@ -4,14 +4,16 @@ msgstr "Content-Type: text/plain; charset=utf-8\n" msgctxt "error:sale.sale:" msgid "What shop would like to sell? Go to preferences" -msgstr "Quina botiga vol vendre? Ves a les preferencies" +msgstr "" +"A quina botiga voleu vendre? Aneu a les vostres preferencies per configurar " +"la vostra botiga." msgctxt "error:sale.sale:" msgid "" -"You cannot edit this order because you do not have permission to edit " -"in this shop." +"You cannot edit this order because you do not have permission to edit in " +"this shop." msgstr "" -"No pot editar aquesta comanda perque no disponsa de permisos d'edició en " +"No podeu editar aquesta comanda perque no disposeu de permisos d'edició en " "aquesta botiga." msgctxt "field:res.user,shop:" @@ -26,6 +28,10 @@ msgctxt "field:sale.sale,shop:" msgid "Shop" msgstr "Botiga" +msgctxt "field:sale.shop,company:" +msgid "Company" +msgstr "Empresa" + msgctxt "field:sale.shop,create_date:" msgid "Create Date" msgstr "Data creació" @@ -38,10 +44,6 @@ msgctxt "field:sale.shop,id:" msgid "ID" msgstr "ID" -msgctxt "field:sale.shop,location:" -msgid "Location" -msgstr "Ubicació" - msgctxt "field:sale.shop,name:" msgid "Shop Name" msgstr "Nom botiga" @@ -140,11 +142,11 @@ msgstr "Manual" msgctxt "selection:sale.shop,sale_invoice_method:" msgid "On Order Processed" -msgstr "Al procesar la comanda" +msgstr "Al processar la comanda" msgctxt "selection:sale.shop,sale_invoice_method:" msgid "On Shipment Sent" -msgstr "Al enviar-ho" +msgstr "A l'enviar-ho" msgctxt "selection:sale.shop,sale_shipment_method:" msgid "Manual" @@ -152,11 +154,11 @@ msgstr "Manual" msgctxt "selection:sale.shop,sale_shipment_method:" msgid "On Invoice Paid" -msgstr "En pagar la factura" +msgstr "Al pagar la factura" msgctxt "selection:sale.shop,sale_shipment_method:" msgid "On Order Processed" -msgstr "Al procesar la comanda" +msgstr "Al processar la comanda" msgctxt "view:res.user:" msgid "Shops" diff --git a/locale/es_ES.po b/locale/es_ES.po old mode 100755 new mode 100644 index 9cb9056..bab08d8 --- a/locale/es_ES.po +++ b/locale/es_ES.po @@ -4,12 +4,14 @@ msgstr "Content-Type: text/plain; charset=utf-8\n" msgctxt "error:sale.sale:" msgid "What shop would like to sell? Go to preferences" -msgstr "¿Qué tienda quiere vender? Acceda a sus preferencias" +msgstr "" +"¿En qué tienda quiere vender? Acceda a sus preferencias para configurar su " +"tienda." msgctxt "error:sale.sale:" msgid "" -"You cannot edit this order because you do not have permission to edit " -"in this shop." +"You cannot edit this order because you do not have permission to edit in " +"this shop." msgstr "" "No puede editar este pedido porque no dispone de permiso de edición en esta " "tienda." @@ -26,6 +28,10 @@ msgctxt "field:sale.sale,shop:" msgid "Shop" msgstr "Tienda" +msgctxt "field:sale.shop,company:" +msgid "Company" +msgstr "Empresa" + msgctxt "field:sale.shop,create_date:" msgid "Create Date" msgstr "Fecha creación" @@ -44,7 +50,7 @@ msgstr "Nombre tienda" msgctxt "field:sale.shop,payment_term:" msgid "Payment Term" -msgstr "Plazos de pago" +msgstr "Plazo de pago" msgctxt "field:sale.shop,price_list:" msgid "Pricelist" diff --git a/sale.py b/sale.py old mode 100755 new mode 100644 index 8bb1595..0ffd7bc --- a/sale.py +++ b/sale.py @@ -29,34 +29,38 @@ class Sale: user = User(Transaction().user) if user.shop: if not res.get('price_list') and res.get('invoice_address'): + res['price_list'] = Shop(user.shop).price_list.id res['price_list.rec_name'] = Shop(user.shop).price_list.rec_name if not res.get('payment_term') and res.get('invoice_address'): - res['payment_term.rec_name'] = Shop.browse(user.shop).payment_term.rec_name + res['payment_term'] = Shop(user.shop).payment_term.id + res['payment_term.rec_name'] = \ + Shop(user.shop).payment_term.rec_name return res @staticmethod def default_company(): User = Pool().get('res.user') user = User(Transaction().user) - return user.shop and user.shop.company.id or Transaction().context.get('company') + return user.shop.company.id if user.shop else \ + Transaction().context.get('company') @staticmethod def default_shop(): User = Pool().get('res.user') user = User(Transaction().user) - return user.shop and user.shop.id or False + return user.shop.id if user.shop else None @staticmethod def default_invoice_method(): User = Pool().get('res.user') user = User(Transaction().user) - return user.shop and user.shop.sale_invoice_method or 'manual' + return user.shop.sale_invoice_method if user.shop else 'manual' @staticmethod def default_shipment_method(): User = Pool().get('res.user') user = User(Transaction().user) - return user.shop and user.shop.sale_shipment_method or 'manual' + return user.shop.sale_shipment_method if user.shop else 'manual' @staticmethod def default_warehouse(): @@ -68,6 +72,18 @@ class Sale: Location = Pool().get('stock.location') return Location.search([('type', '=', 'warehouse')], limit=1)[0].id + @staticmethod + def default_price_list(): + User = Pool().get('res.user') + user = User(Transaction().user) + return user.shop.price_list.id if user.shop else None + + @staticmethod + def default_payment_term(): + User = Pool().get('res.user') + user = User(Transaction().user) + return user.shop.payment_term.id if user.shop else None + @classmethod def set_reference(cls, sales): ''' diff --git a/sale.xml b/sale.xml old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 diff --git a/shop.py b/shop.py old mode 100755 new mode 100644 index 8264757..257e351 --- a/shop.py +++ b/shop.py @@ -10,6 +10,7 @@ __all__ = ['SaleShop', 'SaleShopResUser'] class SaleShop(ModelSQL, ModelView): + 'Sale Shop' __name__ = 'sale.shop' name = fields.Char('Shop Name', required=True, select=True) users = fields.Many2Many('sale.shop-res.user', 'shop', 'user', 'Users') diff --git a/shop.xml b/shop.xml old mode 100755 new mode 100644 diff --git a/tests/__init__.py b/tests/__init__.py old mode 100755 new mode 100644 diff --git a/tests/scenario_sale_shop.rst b/tests/scenario_sale_shop.rst old mode 100755 new mode 100644 diff --git a/tests/test_sale_shop.py b/tests/test_sale_shop.py old mode 100755 new mode 100644 diff --git a/user.py b/user.py old mode 100755 new mode 100644 diff --git a/user.xml b/user.xml old mode 100755 new mode 100644 diff --git a/view/sale_tree.xml b/view/sale_tree.xml index 7dba96f..092432e 100644 --- a/view/sale_tree.xml +++ b/view/sale_tree.xml @@ -1,6 +1,6 @@ - +