Minor fixes

This commit is contained in:
Oscar Alvarez 2020-11-30 22:38:25 -05:00
parent 41f87c2604
commit 51925b86cc
2 changed files with 44 additions and 12 deletions

29
.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/build
/dist
*egg-info
/node_modules
# testing
/coverage
# production
/build
# misc
.DS_Store
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock*
/__pycache__
/app/__pycache__
/app/commons/__pycache__

View File

@ -1,5 +1,5 @@
#This file is part of Tryton. The COPYRIGHT file at the top level
#of this repository contains the full copyright notices and license terms.
# 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 __future__ import with_statement
from datetime import date
from decimal import Decimal
@ -10,15 +10,17 @@ from trytond.transaction import Transaction
from trytond.wizard import Wizard, StateView, Button, StateTransition, StateReport
from trytond.pyson import Eval
__all__ = ['Purchase', 'PurchaseLine', 'PurchaseDetailedReport',
'PurchaseAnalyticStart', 'PurchaseAnalytic',
'PurchaseAnalyticReport', 'PurchaseForceCancel',
'Purchase']
__all__ = [
'Purchase', 'PurchaseLine', 'PurchaseDetailedReport', 'Purchase',
'PurchaseAnalyticStart', 'PurchaseAnalytic', 'PurchaseAnalyticReport',
'PurchaseForceCancel',
]
_STATES = {
'readonly': Eval('state') != 'draft',
}
class Purchase(metaclass=PoolMeta):
__name__ = 'purchase.purchase'
@ -26,8 +28,8 @@ class Purchase(metaclass=PoolMeta):
def __setup__(cls):
super(Purchase, cls).__setup__()
cls._error_messages.update({
'duplicate_purchase': ('Purchase Duplicate! already exists other purchase with reference"%s".'),
})
'duplicate_purchase': ('Purchase Duplicate! already exists other purchase with reference"%s".'),
})
@classmethod
def confirm(cls, purchases):
@ -96,8 +98,8 @@ class Purchase(metaclass=PoolMeta):
PurchaseLine.create(create_lines)
return count
class PurchaseLine:
__metaclass__ = PoolMeta
class PurchaseLine(metaclass=PoolMeta):
__name__ = 'purchase.line'
date_start = fields.Date('Date Start')
date_end = fields.Date('Date End')
@ -120,7 +122,8 @@ class PurchaseDetailedReport(Report):
@classmethod
def get_context(cls, records, data):
report_context = super(PurchaseDetailedReport, cls).get_context(records, data)
report_context = super(PurchaseDetailedReport, cls).get_context(
records, data)
user = Pool().get('res.user')(Transaction().user)
report_context['company'] = user.company
@ -151,7 +154,7 @@ class PurchaseAnalytic(Wizard):
'purchase_report.purchase_analytic_start_view_form', [
Button('Cancel', 'end', 'tryton-cancel'),
Button('Print', 'print_', 'tryton-ok', default=True),
])
])
print_ = StateReport('purchase_report.analytic.report')
def do_print_(self, action):