diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 17a58b8..b424cee 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -235,6 +235,10 @@ msgctxt "field:sale.sale,residual_amount:"
msgid "Residual Amount"
msgstr "Pendent"
+msgctxt "field:sale.sale,sale_device:"
+msgid "Sale Device"
+msgstr "Terminal de venda"
+
msgctxt "field:sale.sale,self_pick_up:"
msgid "Self Pick Up"
msgstr "Auto-recollida"
@@ -267,34 +271,10 @@ msgctxt "field:sale_pos.add_product_form,id:"
msgid "ID"
msgstr "ID"
-msgctxt "field:sale_pos.add_product_form,product:"
-msgid "Product"
-msgstr "Producte"
-
-msgctxt "field:sale_pos.add_product_form,product_uom_category:"
-msgid "Product Uom Category"
-msgstr "Categoria UdM del producte"
-
-msgctxt "field:sale_pos.add_product_form,quantity:"
-msgid "Quantity"
-msgstr "Quantitat"
-
msgctxt "field:sale_pos.add_product_form,sale:"
msgid "Sale"
msgstr "Venda"
-msgctxt "field:sale_pos.add_product_form,unit:"
-msgid "Unit"
-msgstr "Unitat"
-
-msgctxt "field:sale_pos.add_product_form,unit_digits:"
-msgid "Unit Digits"
-msgstr "Dígits unitat"
-
-msgctxt "field:sale_pos.add_product_form,unit_price:"
-msgid "Unit price"
-msgstr "Preu unitat"
-
msgctxt "help:sale.sale,self_pick_up:"
msgid ""
"The goods are picked up by the customer before the sale, so no shipment is "
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 3777bcd..03eb609 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -235,6 +235,10 @@ msgctxt "field:sale.sale,residual_amount:"
msgid "Residual Amount"
msgstr "Pendiente"
+msgctxt "field:sale.sale,sale_device:"
+msgid "Sale Device"
+msgstr "Terminal de venta"
+
msgctxt "field:sale.sale,self_pick_up:"
msgid "Self Pick Up"
msgstr "Autorecogida"
@@ -267,34 +271,10 @@ msgctxt "field:sale_pos.add_product_form,id:"
msgid "ID"
msgstr "ID"
-msgctxt "field:sale_pos.add_product_form,product:"
-msgid "Product"
-msgstr "Producto"
-
-msgctxt "field:sale_pos.add_product_form,product_uom_category:"
-msgid "Product Uom Category"
-msgstr "Categoría UdM del producto"
-
-msgctxt "field:sale_pos.add_product_form,quantity:"
-msgid "Quantity"
-msgstr "Cantidad"
-
msgctxt "field:sale_pos.add_product_form,sale:"
msgid "Sale"
msgstr "Venta"
-msgctxt "field:sale_pos.add_product_form,unit:"
-msgid "Unit"
-msgstr "Unidad"
-
-msgctxt "field:sale_pos.add_product_form,unit_digits:"
-msgid "Unit Digits"
-msgstr "Dígitos unidad"
-
-msgctxt "field:sale_pos.add_product_form,unit_price:"
-msgid "Unit price"
-msgstr "Precio unidad"
-
msgctxt "help:sale.sale,self_pick_up:"
msgid ""
"The goods are picked up by the customer before the sale, so no shipment is "
diff --git a/sale.py b/sale.py
index 2d87725..8dd0ab5 100644
--- a/sale.py
+++ b/sale.py
@@ -10,7 +10,9 @@ from trytond.transaction import Transaction
from trytond.wizard import Wizard, StateView, StateTransition, Button
-__all__ = ['Sale', 'SalePaymentForm', 'WizardSalePayment', 'WizardSaleReconcile']
+__all__ = ['Sale', 'SalePaymentForm', 'WizardSalePayment',
+ 'WizardSaleReconcile']
+
__metaclass__ = PoolMeta
@@ -21,6 +23,10 @@ class Sale:
'get_paid_amount')
residual_amount = fields.Function(fields.Numeric('Residual Amount',
readonly=True), 'get_residual_amount')
+ sale_device = fields.Many2One('sale.device', 'Sale Device',
+ domain=[('shop', '=', Eval('shop'))],
+ depends=['shop']
+ )
@classmethod
def __setup__(cls):
@@ -32,6 +38,12 @@ class Sale:
},
})
+ @staticmethod
+ def default_sale_device():
+ User = Pool().get('res.user')
+ user = User(Transaction().user)
+ return user.sale_device or None
+
@classmethod
def get_paid_amount(cls, sales, names):
result = {n: {s.id: Decimal(0) for s in sales} for n in names}
@@ -109,12 +121,13 @@ class WizardSalePayment(Wizard):
User = pool.get('res.user')
sale = Sale(Transaction().context['active_id'])
user = User(Transaction().user)
- if user.id != 0 and not user.sale_device:
+ sale_device = sale.sale_device or user.sale_device or False
+ if user.id != 0 and not sale_device:
self.raise_user_error('not_sale_device')
return {
- 'journal': user.sale_device.journal.id
- if user.sale_device.journal else None,
- 'journals': [j.id for j in user.sale_device.journals],
+ 'journal': sale_device.journal.id
+ if sale_device.journal else None,
+ 'journals': [j.id for j in sale_device.journals],
'payment_amount': sale.total_amount - sale.paid_amount
if sale.paid_amount else sale.total_amount,
'currency_digits': sale.currency_digits,
diff --git a/tryton.cfg b/tryton.cfg
index 13fd5df..d52e3c3 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -4,7 +4,7 @@ depends:
account_statement
sale_shop
xml:
- sale.xml
device.xml
- user.xml
+ sale.xml
statement.xml
+ user.xml
diff --git a/view/sale_form.xml b/view/sale_form.xml
index d7a7f53..a44f4a2 100644
--- a/view/sale_form.xml
+++ b/view/sale_form.xml
@@ -25,4 +25,11 @@ copyright notices and license terms. -->
+
+
+
+
+
diff --git a/view/user_form.xml b/view/user_form.xml
index 3441e01..2d3e4e7 100644
--- a/view/user_form.xml
+++ b/view/user_form.xml
@@ -7,6 +7,6 @@ copyright notices and license terms. -->
expr="/form/notebook/page[@id="preferences"]/field[@name="shop"]"
position="after">
-
+