diff --git a/__init__.py b/__init__.py
index 1a52ad9..6736367 100644
--- a/__init__.py
+++ b/__init__.py
@@ -14,6 +14,8 @@ from . import production
from . import location
from . import move
from . import price_list
+from . import sale
+from . import account
def register():
Pool.register(
@@ -75,10 +77,12 @@ def register():
location.Location,
move.Move,
price_list.PriceList,
+ account.Statement,
module='agronomics', type_='model')
Pool.register(
production.ProductionCostPriceDistributionTemplateProductionTemplate,
plot.CreateNewParcels,
+ sale.WizardAddProduct,
module='agronomics', type_='wizard')
Pool.register(
module='agronomics', type_='report')
diff --git a/account.py b/account.py
new file mode 100644
index 0000000..26886ff
--- /dev/null
+++ b/account.py
@@ -0,0 +1,23 @@
+# The COPYRIGHT file at the top level of this repository contains
+# the full copyright notices and license terms.
+from decimal import Decimal
+from trytond.model import fields
+from trytond.pool import PoolMeta
+
+
+class Statement(metaclass=PoolMeta):
+ __name__ = 'account.statement'
+
+ @fields.depends('journal', 'state', 'lines', 'number_of_lines',
+ 'total_amount')
+ def on_change_journal(self):
+ super().on_change_journal()
+ if not self.journal:
+ return
+ if (self.journal.validation == 'amount' and not self.total_amount):
+ self.total_amount = Decimal(0)
+ elif (self.journal.validation == 'number_of_lines' and not
+ self.number_of_lines):
+ self.number_of_lines = 0
+ else:
+ return
diff --git a/sale.py b/sale.py
new file mode 100644
index 0000000..abd6071
--- /dev/null
+++ b/sale.py
@@ -0,0 +1,50 @@
+# The COPYRIGHT file at the top level of this repository contains
+# the full copyright notices and license terms.
+from trytond.pool import PoolMeta, Pool
+
+
+class WizardAddProduct(metaclass=PoolMeta):
+ __name__ = 'sale_pos.add_product'
+
+ def transition_scan_(self):
+ pool = Pool()
+ Product = pool.get('product.product')
+
+ def qty(value):
+ try:
+ return float(value)
+ except ValueError:
+ return False
+
+ product = None
+ value = self.start.input_value
+ quantity = qty(value)
+ if len(value) > 4:
+ quantity = None
+
+ if not quantity:
+ domain = ['OR', ('code','=', value),
+ ('identifiers.code', '=', value),
+ ('name', 'like', '%'+value+'%')]
+ products = Product.search(domain)
+ if not products:
+ return 'start'
+
+ if len(products) > 1:
+ self.choose.products = [x.id for x in products]
+ return 'choose'
+
+ product, = products
+
+ self.start.last_product = product
+
+ if quantity and self.start.last_product:
+ product = self.start.last_product
+
+ if not product:
+ return 'start'
+
+ lines = self.add_sale_line(self.start.lines, product, quantity)
+ self.start.lines = lines
+ self.add_lines()
+ return 'start'
diff --git a/sale.xml b/sale.xml
new file mode 100644
index 0000000..23768e3
--- /dev/null
+++ b/sale.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+ sale.sale
+
+ sale_pos_form
+
+
+
diff --git a/tryton.cfg b/tryton.cfg
index 5584f52..b21fbb2 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -13,6 +13,9 @@ depends:
stock
account_invoice
account_invoice_line_standalone
+ sale
+ sale_pos
+ account_statement
xml:
plot.xml
party.xml
@@ -26,3 +29,4 @@ xml:
contract.xml
invoice.xml
history.xml
+ sale.xml
diff --git a/view/sale_pos_form.xml b/view/sale_pos_form.xml
new file mode 100644
index 0000000..529486b
--- /dev/null
+++ b/view/sale_pos_form.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+