mirror of
https://bitbucket.org/presik/trytonpsk-purchase_co.git
synced 2023-12-14 06:43:05 +01:00
Add purchase report
This commit is contained in:
parent
5464a87870
commit
594e46b374
6 changed files with 32 additions and 13 deletions
|
@ -1,10 +1,10 @@
|
|||
# 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 decimal import Decimal
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.modules.product import price_digits
|
||||
|
||||
|
||||
class Product(metaclass=PoolMeta):
|
||||
__name__ = 'product.product'
|
||||
last_cost = fields.Function(fields.Numeric('Last Cost', digits=price_digits,
|
||||
|
|
BIN
purchase.fodt
Normal file
BIN
purchase.fodt
Normal file
Binary file not shown.
21
purchase.py
21
purchase.py
|
@ -8,13 +8,16 @@ from trytond.model import fields, ModelView
|
|||
from trytond.exceptions import UserError
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.report import Report
|
||||
from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition
|
||||
from trytond.wizard import (
|
||||
Wizard, StateView, Button, StateReport, StateTransition
|
||||
)
|
||||
|
||||
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.configuration'
|
||||
reference_required = fields.Boolean('Reference Required')
|
||||
all_warehouse = fields.Boolean('All Warehouse', 'See quantity in all warehouse')
|
||||
all_warehouse = fields.Boolean('All Warehouse',
|
||||
help='See quantity in all warehouse')
|
||||
|
||||
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
|
@ -264,7 +267,7 @@ class PurchaseAnalyticReport(Report):
|
|||
'analytic_accounts.account.name', 'analytic_accounts.account.code', 'taxes',
|
||||
'invoice_lines.unit_price', 'moves.quantity', 'amount', 'purchase.warehouse.name',
|
||||
'purchase.number'
|
||||
|
||||
|
||||
]
|
||||
|
||||
lines = PurchaseLine.search_read([
|
||||
|
@ -342,7 +345,7 @@ class PurchasesDetailedReport(Report):
|
|||
]
|
||||
|
||||
fields_names_detailed = [
|
||||
'product.rec_name', 'product.type', 'product.categories.name', 'quantity', 'unit_price',
|
||||
'product.rec_name', 'product.type', 'product.categories.name', 'quantity', 'unit_price',
|
||||
]
|
||||
|
||||
fields = Purchase.fields_get(fields_names=['operation_center'])
|
||||
|
@ -367,7 +370,7 @@ class PurchasesDetailedReport(Report):
|
|||
else:
|
||||
fields_add=['invoice_date', 'purchases.description', 'purchases.number']
|
||||
fields_names.extend(fields_add)
|
||||
|
||||
|
||||
dom_ = [
|
||||
('company', '=', data['company']),
|
||||
('invoice_date', '>=', data['start_date']),
|
||||
|
@ -381,7 +384,7 @@ class PurchasesDetailedReport(Report):
|
|||
if 'operation_center' in fields.keys():
|
||||
fields_names_detailed.append('purchase.operation_center.name')
|
||||
fields_names.append('operation_center.name')
|
||||
|
||||
|
||||
|
||||
if data['detailed']:
|
||||
fields_add = ['purchase.party.name', 'purchase.party.id_number', 'purchase.number', 'purchase.purchase_date']
|
||||
|
@ -405,10 +408,10 @@ class PurchasesDetailedReport(Report):
|
|||
('purchase_date', 'ASC')
|
||||
])
|
||||
|
||||
states = {
|
||||
states = {
|
||||
'posted': 'contabilizado',
|
||||
'paid': 'pagada',
|
||||
'draft': 'borrador',
|
||||
'paid': 'pagada',
|
||||
'draft': 'borrador',
|
||||
'done': 'finalizado',
|
||||
'processing': 'procesada',
|
||||
'quotation': 'cotizacion',
|
||||
|
|
16
purchase.xml
16
purchase.xml
|
@ -4,6 +4,22 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<tryton>
|
||||
<data>
|
||||
|
||||
<record model="ir.action.report" id="purchase.report_purchase">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.action.report" id="report_purchase_co">
|
||||
<field name="active" eval="True"/>
|
||||
<field name="name">Purchase</field>
|
||||
<field name="model">purchase.purchase</field>
|
||||
<field name="report_name">purchase.purchase</field>
|
||||
<field name="report">purchase_co/purchase.fodt</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="report_purchase_co_keyword">
|
||||
<field name="keyword">form_print</field>
|
||||
<field name="model">purchase.purchase,-1</field>
|
||||
<field name="action" ref="report_purchase_co"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="purchase_configuration_view_form">
|
||||
<field name="model">purchase.configuration</field>
|
||||
<field name="inherit" ref="purchase.purchase_configuration_view_form"/>
|
||||
|
|
4
setup.py
4
setup.py
|
@ -62,7 +62,7 @@ if minor_version % 2:
|
|||
|
||||
setup(name=name,
|
||||
version=version,
|
||||
description='Module add for see duration of purchase of products on inventory.',
|
||||
description='Module add to purchase new features for Colombia.',
|
||||
long_description=read('README'),
|
||||
author='Presik Technologies',
|
||||
author_email='gerente@presik.com',
|
||||
|
@ -108,4 +108,4 @@ setup(name=name,
|
|||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
tests_require=tests_require,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.4
|
||||
version=6.0.5
|
||||
depends:
|
||||
product
|
||||
purchase
|
||||
|
|
Loading…
Reference in a new issue