mirror of
https://github.com/NaN-tic/trytond-account_invoice_facturae_electronet.git
synced 2023-12-14 04:12:59 +01:00
Get the point of sale code of the invoice based on the shipping
of the first line of invoice. #036530
This commit is contained in:
parent
3f8eacd7bf
commit
9ad8af0fa6
15
invoice.py
15
invoice.py
|
@ -1,6 +1,7 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.model import fields
|
||||
from trytond.config import config
|
||||
import os
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
@ -17,6 +18,9 @@ class Invoice:
|
|||
__metaclass__ = PoolMeta
|
||||
__name__ = 'account.invoice'
|
||||
|
||||
sale_point_code = fields.Function(fields.Char('Sale Point Code'),
|
||||
'get_sale_point_code')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Invoice, cls).__setup__()
|
||||
|
@ -29,6 +33,17 @@ class Invoice:
|
|||
'review the tab General of this party: "%(field)s"')
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def get_sale_point_code(cls, invoices, name):
|
||||
sale_points = {}
|
||||
for invoice in invoices:
|
||||
sale_point = u''
|
||||
address = invoice.shipment_origin_address
|
||||
if address:
|
||||
sale_point = address.electronet_sale_point
|
||||
sale_points[invoice.id] = sale_point
|
||||
return sale_points
|
||||
|
||||
@classmethod
|
||||
def generate_facturae_electronet(cls, invoices, certificate_password=None):
|
||||
to_write = ([],)
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
{% if invoice.party.oficina_contable %}{{ administrative_center(invoice.party.oficina_contable, '01', invoice.party) }}{% endif %}
|
||||
{% if invoice.party.organo_gestor %}{{ administrative_center(invoice.party.organo_gestor, '02', invoice.party) }}{% endif %}
|
||||
{% if invoice.party.unidad_tramitadora %}{{ administrative_center(invoice.party.unidad_tramitadora, '03', invoice.party) }}{% endif %}
|
||||
{% if invoice.invoice_address.electronet_sale_point %}{{ administrative_center(invoice.invoice_address.electronet_sale_point, '04', invoice.party) }}{% endif %}
|
||||
{% if invoice.sale_point_code %}{{ administrative_center(invoice.sale_point_code, '04', invoice.party) }}{% endif %}
|
||||
</AdministrativeCentres>
|
||||
<LegalEntity>
|
||||
<CorporateName>{{ invoice.party.name and invoice.party.name[:80] or invoice.party.code[:80] }}</CorporateName>
|
||||
|
|
|
@ -3,6 +3,7 @@ version=4.8.0
|
|||
depends:
|
||||
ir
|
||||
account_invoice_facturae
|
||||
account_invoice_shipment
|
||||
account_invoice_sale_relation
|
||||
stock_origin_sale
|
||||
xml:
|
||||
|
|
Loading…
Reference in a new issue