add shop in invoices report
This commit is contained in:
parent
f1d6d5beb7
commit
844023ce17
|
@ -23,13 +23,16 @@ def register():
|
|||
sale.SaleLine,
|
||||
sale.SaleShopDetailedStart,
|
||||
invoice.Invoice,
|
||||
invoice.InvoicesStart,
|
||||
module='sale_shop', type_='model')
|
||||
Pool.register(
|
||||
sale.PrintSaleBySupplier,
|
||||
sale.SaleShopDetailed,
|
||||
sale.SaleShopForceDraft,
|
||||
invoice.Invoices,
|
||||
module='sale_shop', type_='wizard')
|
||||
Pool.register(
|
||||
sale.SaleBySupplier,
|
||||
sale.SaleShopDetailedReport,
|
||||
invoice.InvoicesReport,
|
||||
module='sale_shop', type_='report')
|
||||
|
|
35
invoice.py
35
invoice.py
|
@ -4,8 +4,10 @@
|
|||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['Invoice']
|
||||
__all__ = ['Invoice', 'InvoicesStart',
|
||||
'Invoices', 'InvoicesReport']
|
||||
|
||||
|
||||
class Invoice(metaclass=PoolMeta):
|
||||
|
@ -13,3 +15,34 @@ class Invoice(metaclass=PoolMeta):
|
|||
shop = fields.Many2One('sale.shop', 'Shop', required=False, domain=[
|
||||
('id', 'in', Eval('context', {}).get('shops', [])),
|
||||
], depends=['number'])
|
||||
|
||||
|
||||
class InvoicesStart(metaclass=PoolMeta):
|
||||
__name__ = 'invoice_report.print_invoices.start'
|
||||
shop = fields.Many2One('sale.shop', 'Shop', required=True)
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('shop')
|
||||
|
||||
|
||||
class Invoices(metaclass=PoolMeta):
|
||||
__name__ = 'invoice_report.print_invoices'
|
||||
|
||||
def do_print_(self, action):
|
||||
action, data = super(Invoices, self).do_print_(action)
|
||||
if self.start.shop:
|
||||
data['shop'] = self.start.shop.id
|
||||
data['shop_name'] = self.start.shop.name
|
||||
return action, data
|
||||
|
||||
|
||||
class InvoicesReport(metaclass=PoolMeta):
|
||||
__name__ = 'invoice_report.invoices_report'
|
||||
|
||||
@classmethod
|
||||
def get_domain_invoices(cls, data):
|
||||
dom_invoices = super(InvoicesReport, cls).get_domain_invoices(data)
|
||||
if data.get('shop'):
|
||||
dom_invoices.append(('shop', '=', data['shop']))
|
||||
return dom_invoices
|
||||
|
|
6
shop.xml
6
shop.xml
|
@ -51,5 +51,11 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
|
|||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="print_invoices_start_view_form_2">
|
||||
<field name="model">invoice_report.print_invoices.start</field>
|
||||
<field name="inherit" ref="invoice_report.print_invoices_start_view_form"/>
|
||||
<field name="name">print_invoices_start_view_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -5,6 +5,7 @@ depends:
|
|||
account_invoice
|
||||
sale_price_list
|
||||
sale_salesman
|
||||
invoice_report
|
||||
xml:
|
||||
configuration.xml
|
||||
shop.xml
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
|
||||
<xpath expr="/form/label[@name='period']"
|
||||
position="before">
|
||||
<label name="shop"/>
|
||||
<field name="shop" widget="selection"/>
|
||||
</xpath>
|
||||
|
||||
</data>
|
Loading…
Reference in New Issue