Fixed default values in sales + Translations

This commit is contained in:
Jordi Esteve 2013-11-06 22:55:39 +01:00
parent 478f34c941
commit 151ba14a90
21 changed files with 48 additions and 23 deletions

0
CHANGELOG Executable file → Normal file
View File

0
COPYRIGHT Executable file → Normal file
View File

0
INSTALL Executable file → Normal file
View File

0
LICENSE Executable file → Normal file
View File

0
MANIFEST.in Executable file → Normal file
View File

0
README Executable file → Normal file
View File

0
TODO Executable file → Normal file
View File

0
__init__.py Executable file → Normal file
View File

26
locale/ca_ES.po Executable file → Normal file
View File

@ -4,14 +4,16 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:sale.sale:" msgctxt "error:sale.sale:"
msgid "What shop would like to sell? Go to preferences" 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:" msgctxt "error:sale.sale:"
msgid "" msgid ""
"You cannot edit this order because you do not have permission to edit " "You cannot edit this order because you do not have permission to edit in "
"in this shop." "this shop."
msgstr "" 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." "aquesta botiga."
msgctxt "field:res.user,shop:" msgctxt "field:res.user,shop:"
@ -26,6 +28,10 @@ msgctxt "field:sale.sale,shop:"
msgid "Shop" msgid "Shop"
msgstr "Botiga" msgstr "Botiga"
msgctxt "field:sale.shop,company:"
msgid "Company"
msgstr "Empresa"
msgctxt "field:sale.shop,create_date:" msgctxt "field:sale.shop,create_date:"
msgid "Create Date" msgid "Create Date"
msgstr "Data creació" msgstr "Data creació"
@ -38,10 +44,6 @@ msgctxt "field:sale.shop,id:"
msgid "ID" msgid "ID"
msgstr "ID" msgstr "ID"
msgctxt "field:sale.shop,location:"
msgid "Location"
msgstr "Ubicació"
msgctxt "field:sale.shop,name:" msgctxt "field:sale.shop,name:"
msgid "Shop Name" msgid "Shop Name"
msgstr "Nom botiga" msgstr "Nom botiga"
@ -140,11 +142,11 @@ msgstr "Manual"
msgctxt "selection:sale.shop,sale_invoice_method:" msgctxt "selection:sale.shop,sale_invoice_method:"
msgid "On Order Processed" msgid "On Order Processed"
msgstr "Al procesar la comanda" msgstr "Al processar la comanda"
msgctxt "selection:sale.shop,sale_invoice_method:" msgctxt "selection:sale.shop,sale_invoice_method:"
msgid "On Shipment Sent" msgid "On Shipment Sent"
msgstr "Al enviar-ho" msgstr "A l'enviar-ho"
msgctxt "selection:sale.shop,sale_shipment_method:" msgctxt "selection:sale.shop,sale_shipment_method:"
msgid "Manual" msgid "Manual"
@ -152,11 +154,11 @@ msgstr "Manual"
msgctxt "selection:sale.shop,sale_shipment_method:" msgctxt "selection:sale.shop,sale_shipment_method:"
msgid "On Invoice Paid" msgid "On Invoice Paid"
msgstr "En pagar la factura" msgstr "Al pagar la factura"
msgctxt "selection:sale.shop,sale_shipment_method:" msgctxt "selection:sale.shop,sale_shipment_method:"
msgid "On Order Processed" msgid "On Order Processed"
msgstr "Al procesar la comanda" msgstr "Al processar la comanda"
msgctxt "view:res.user:" msgctxt "view:res.user:"
msgid "Shops" msgid "Shops"

14
locale/es_ES.po Executable file → Normal file
View File

@ -4,12 +4,14 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:sale.sale:" msgctxt "error:sale.sale:"
msgid "What shop would like to sell? Go to preferences" 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:" msgctxt "error:sale.sale:"
msgid "" msgid ""
"You cannot edit this order because you do not have permission to edit " "You cannot edit this order because you do not have permission to edit in "
"in this shop." "this shop."
msgstr "" msgstr ""
"No puede editar este pedido porque no dispone de permiso de edición en esta " "No puede editar este pedido porque no dispone de permiso de edición en esta "
"tienda." "tienda."
@ -26,6 +28,10 @@ msgctxt "field:sale.sale,shop:"
msgid "Shop" msgid "Shop"
msgstr "Tienda" msgstr "Tienda"
msgctxt "field:sale.shop,company:"
msgid "Company"
msgstr "Empresa"
msgctxt "field:sale.shop,create_date:" msgctxt "field:sale.shop,create_date:"
msgid "Create Date" msgid "Create Date"
msgstr "Fecha creación" msgstr "Fecha creación"
@ -44,7 +50,7 @@ msgstr "Nombre tienda"
msgctxt "field:sale.shop,payment_term:" msgctxt "field:sale.shop,payment_term:"
msgid "Payment Term" msgid "Payment Term"
msgstr "Plazos de pago" msgstr "Plazo de pago"
msgctxt "field:sale.shop,price_list:" msgctxt "field:sale.shop,price_list:"
msgid "Pricelist" msgid "Pricelist"

26
sale.py Executable file → Normal file
View File

@ -29,34 +29,38 @@ class Sale:
user = User(Transaction().user) user = User(Transaction().user)
if user.shop: if user.shop:
if not res.get('price_list') and res.get('invoice_address'): 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 res['price_list.rec_name'] = Shop(user.shop).price_list.rec_name
if not res.get('payment_term') and res.get('invoice_address'): 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 return res
@staticmethod @staticmethod
def default_company(): def default_company():
User = Pool().get('res.user') User = Pool().get('res.user')
user = User(Transaction().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 @staticmethod
def default_shop(): def default_shop():
User = Pool().get('res.user') User = Pool().get('res.user')
user = User(Transaction().user) user = User(Transaction().user)
return user.shop and user.shop.id or False return user.shop.id if user.shop else None
@staticmethod @staticmethod
def default_invoice_method(): def default_invoice_method():
User = Pool().get('res.user') User = Pool().get('res.user')
user = User(Transaction().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 @staticmethod
def default_shipment_method(): def default_shipment_method():
User = Pool().get('res.user') User = Pool().get('res.user')
user = User(Transaction().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 @staticmethod
def default_warehouse(): def default_warehouse():
@ -68,6 +72,18 @@ class Sale:
Location = Pool().get('stock.location') Location = Pool().get('stock.location')
return Location.search([('type', '=', 'warehouse')], limit=1)[0].id 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 @classmethod
def set_reference(cls, sales): def set_reference(cls, sales):
''' '''

0
sale.xml Executable file → Normal file
View File

0
setup.py Executable file → Normal file
View File

1
shop.py Executable file → Normal file
View File

@ -10,6 +10,7 @@ __all__ = ['SaleShop', 'SaleShopResUser']
class SaleShop(ModelSQL, ModelView): class SaleShop(ModelSQL, ModelView):
'Sale Shop'
__name__ = 'sale.shop' __name__ = 'sale.shop'
name = fields.Char('Shop Name', required=True, select=True) name = fields.Char('Shop Name', required=True, select=True)
users = fields.Many2Many('sale.shop-res.user', 'shop', 'user', 'Users') users = fields.Many2Many('sale.shop-res.user', 'shop', 'user', 'Users')

0
shop.xml Executable file → Normal file
View File

0
tests/__init__.py Executable file → Normal file
View File

0
tests/scenario_sale_shop.rst Executable file → Normal file
View File

0
tests/test_sale_shop.py Executable file → Normal file
View File

0
user.py Executable file → Normal file
View File

0
user.xml Executable file → Normal file
View File

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- This file is part sale_shop module for Tryton. <!-- This file is part of Tryton. The COPYRIGHT file at the top level of
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. --> this repository contains the full copyright notices and license terms. -->
<data> <data>
<xpath <xpath
expr="/tree/field[@name=&quot;reference&quot;]" position="before"> expr="/tree/field[@name=&quot;reference&quot;]" position="before">