From 78948ed2621922f2042e0e3c4647ca8716514665 Mon Sep 17 00:00:00 2001 From: oscar alvarez Date: Fri, 20 Oct 2023 18:54:42 -0500 Subject: [PATCH] Minor fixes and update version --- account.py | 5 +++-- device.py | 6 +++--- invoice.py | 3 +-- product.py | 2 +- sale.py | 4 ++-- shop.py | 8 +++++--- statement.py | 35 ++++++++++++++++++++--------------- tryton.cfg | 2 +- user.py | 1 - 9 files changed, 36 insertions(+), 30 deletions(-) diff --git a/account.py b/account.py index 5782254..0816fe3 100644 --- a/account.py +++ b/account.py @@ -24,11 +24,12 @@ class SaleAccountMovesStart(ModelView): class SaleAccountMoves(Wizard): 'Sale Account Moves' __name__ = 'sale_pos.sale_account_moves' - start = StateView('sale_pos.sale_account_moves.start', + start = StateView( + 'sale_pos.sale_account_moves.start', 'sale_pos.sale_account_moves_start_view_form', [ Button('Cancel', 'end', 'tryton-cancel'), Button('Print', 'print_', 'tryton-print', default=True), - ]) + ]) print_ = StateReport('sale_pos.sale_account_moves_report') def do_print_(self, action): diff --git a/device.py b/device.py index 20ace13..85394ff 100755 --- a/device.py +++ b/device.py @@ -9,8 +9,8 @@ from trytond.pyson import Eval class SaleDevice(ModelSQL, ModelView): 'Sale Device' __name__ = 'sale.device' - name = fields.Char('Device Name', required=True, select=True) - code = fields.Char('Code', select=True) + name = fields.Char('Device Name', required=True) + code = fields.Char('Code') shop = fields.Many2One('sale.shop', 'Shop', required=True) company = fields.Function(fields.Many2One('company.company', 'Company',), 'get_company', searcher='search_company') @@ -56,7 +56,7 @@ class SaleDeviceStatementJournal(ModelSQL): __name__ = 'sale.device.account.statement.journal' _table = 'sale_device_account_statement_journal' device = fields.Many2One('sale.device', 'Sale Device', - ondelete='CASCADE', select=True, required=True) + ondelete='CASCADE', required=True) journal = fields.Many2One('account.statement.journal', 'Statement Journal', ondelete='RESTRICT', required=True) diff --git a/invoice.py b/invoice.py index 979f82d..bcc9bcf 100644 --- a/invoice.py +++ b/invoice.py @@ -39,8 +39,7 @@ class Invoice(metaclass=PoolMeta): if (invoice.type == 'out' and not invoice.company.cancel_invoice_out): raise AccessError( - gettext('account_invoice' - '.msg_invoice_customer_cancel_move', + gettext('account_invoice.msg_invoice_customer_cancel_move', invoice=invoice.rec_name)) invoice.cancel_move = invoice.move.cancel() to_save.append(invoice) diff --git a/product.py b/product.py index f57a9f9..3429ba2 100644 --- a/product.py +++ b/product.py @@ -2,6 +2,7 @@ # 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, ModelSQL, DeactivableMixin from trytond.pool import PoolMeta, Pool from trytond.modules.product import price_digits @@ -116,4 +117,3 @@ class Template(metaclass=PoolMeta): class Category(DeactivableMixin, metaclass=PoolMeta): __name__ = 'product.category' - diff --git a/sale.py b/sale.py index 1143532..52ab279 100644 --- a/sale.py +++ b/sale.py @@ -6,7 +6,7 @@ from decimal import Decimal from datetime import datetime, date, timedelta from itertools import chain from sql import Null, Table, With -from sql.operators import NotIn, Or +from sql.operators import NotIn from sql.aggregate import Sum, Count from sql.conditionals import Case, Coalesce @@ -2048,4 +2048,4 @@ class DeleteSalesDraft(Wizard): if len(sales_delete) > 1: cursor.execute("DELETE from sale_sale WHERE \ id in (%s)" % (', '.join(sales_delete))) - return 'end' \ No newline at end of file + return 'end' diff --git a/shop.py b/shop.py index 8381ebf..df98bf9 100644 --- a/shop.py +++ b/shop.py @@ -20,11 +20,13 @@ class SaleShop(metaclass=PoolMeta): __name__ = 'sale.shop' party = fields.Many2One('party.party', 'Default Party') invoice_sequence = fields.Many2One('ir.sequence.strict', 'Invoice Sequence') - credit_note_sequence = fields.Many2One('ir.sequence.strict', 'Credit Note Sequence') + credit_note_sequence = fields.Many2One('ir.sequence.strict', + 'Credit Note Sequence') self_pick_up = fields.Boolean('Default Self Pick Up', help='The goods are picked up by the customer before the sale, so no ' 'shipment is created.') - pos_authorization = fields.Many2One('account.invoice.authorization', 'Pos Authorization', domain=[ + pos_authorization = fields.Many2One('account.invoice.authorization', + 'POS Authorization', domain=[ ('kind', '=', 'P'), ('company', '=', Eval('company')), ]) @@ -106,7 +108,7 @@ class ShopDailySummaryReport(Report): Line = pool.get('sale.line') Invoice = pool.get('account.invoice') Company = pool.get('company.company') - fixed_hour = time(6, 0) + fixed_hour = time(6, 0) cursor = Transaction().connection.cursor() sale = Sale.__table__() diff --git a/statement.py b/statement.py index 4b30c0d..f1e265a 100755 --- a/statement.py +++ b/statement.py @@ -25,8 +25,9 @@ class Journal(metaclass=PoolMeta): class Statement(metaclass=PoolMeta): __name__ = 'account.statement' - users = fields.Function(fields.One2Many('res.user', None, 'Users'), - 'get_users', setter='set_users', searcher='search_users') + users = fields.Function(fields.One2Many( + 'res.user', None, 'Users'), + 'get_users', setter='set_users', searcher='search_users') turn = fields.Integer('Turn', states={'readonly': True}) count_money = fields.One2Many( 'sale_pos.money_count', 'statement', 'Count Money') @@ -75,7 +76,7 @@ class Statement(metaclass=PoolMeta): def get_amount_difference(self, name): res = 0 - amount = sum(l.amount for l in self.lines) + amount = sum(li.amount for li in self.lines) if self.total_money is not None: res = self.total_money - amount return res @@ -331,15 +332,17 @@ class OpenStatementDone(ModelView): class OpenStatement(Wizard): 'Open Statement' __name__ = 'open.statement' - start = StateView('open.statement.start', + start = StateView( + 'open.statement.start', 'sale_pos.open_statement_start', [ Button('Cancel', 'end', 'tryton-cancel'), Button('Ok', 'create_', 'tryton-ok', default=True), ]) create_ = StateTransition() - done = StateView('open.statement.done', + done = StateView( + 'open.statement.done', 'sale_pos.open_statement_done', [ - Button('Done', 'end', 'tryton-ok', default=True), + Button('Done', 'end', 'tryton-ok', default=True), ]) @classmethod @@ -446,16 +449,18 @@ class CloseStatementDone(ModelView): class CloseStatement(Wizard): 'Close Statement' __name__ = 'close.statement' - start = StateView('close.statement.start', - 'sale_pos.close_statement_start', [ - Button('Cancel', 'end', 'tryton-cancel'), - Button('Ok', 'validate', 'tryton-ok', default=True), - ]) + start = StateView( + 'close.statement.start', + 'sale_pos.close_statement_start', [ + Button('Cancel', 'end', 'tryton-cancel'), + Button('Ok', 'validate', 'tryton-ok', default=True), + ]) validate = StateTransition() - done = StateView('close.statement.done', - 'sale_pos.close_statement_done', [ - Button('Done', 'end', 'tryton-ok', default=True), - ]) + done = StateView( + 'close.statement.done', + 'sale_pos.close_statement_done', [ + Button('Done', 'end', 'tryton-ok', default=True), + ]) @classmethod def __setup__(cls): diff --git a/tryton.cfg b/tryton.cfg index fb5bff6..a1fb9f2 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.0.10 +version=6.0.11 depends: account account_statement diff --git a/user.py b/user.py index 9ff1e99..8de1db0 100755 --- a/user.py +++ b/user.py @@ -1,7 +1,6 @@ # This file is part of the sale_payment module for Tryton. # The COPYRIGHT file at the top level of this repository contains the full # copyright notices and license terms. -from trytond import backend from trytond.model import fields from trytond.pool import PoolMeta from trytond.pyson import Eval