-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsale.py
33 lines (27 loc) · 1.03 KB
/
sale.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This file is part sale_pos_ar module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
pos = fields.Many2One('account.pos', 'Point of Sale',
domain=[('pos_daily_report', '=', False)],
states={'readonly': Eval('state') != 'draft'})
@staticmethod
def default_pos():
Configuration = Pool().get('sale.configuration')
config = Configuration(1)
if config.pos:
return config.pos.id
def create_invoice(self):
invoice = super().create_invoice()
if invoice:
invoice.save()
invoice.pos = self.pos
invoice.invoice_type = invoice.on_change_with_invoice_type()
invoice.set_pyafipws_concept()
invoice.set_pyafipws_billing_dates()
invoice.save()
return invoice