diff --git a/stock_batch_picking_voucher/models/__init__.py b/stock_batch_picking_voucher/models/__init__.py index 959ceba9d..f9dc4d14c 100644 --- a/stock_batch_picking_voucher/models/__init__.py +++ b/stock_batch_picking_voucher/models/__init__.py @@ -1,2 +1,2 @@ from . import stock_picking_voucher -from . import stock_batch_picking +from . import stock_picking_batch diff --git a/stock_batch_picking_voucher/models/stock_batch_picking.py b/stock_batch_picking_voucher/models/stock_picking_batch.py similarity index 89% rename from stock_batch_picking_voucher/models/stock_batch_picking.py rename to stock_batch_picking_voucher/models/stock_picking_batch.py index bc4642eab..62f385dc0 100644 --- a/stock_batch_picking_voucher/models/stock_batch_picking.py +++ b/stock_batch_picking_voucher/models/stock_picking_batch.py @@ -64,12 +64,7 @@ def assign_numbers(self, estimated_number_of_pages, book): estimated_number_of_pages = fields.Integer( 'Number of Pages', ) - - lines_per_voucher = fields.Integer( - 'Lines Per Voucher', - related='book_id.lines_per_voucher', - ) - + @api.model def _get_book(self): return self.book_id or self.env['stock.book'].search([('company_id', '=', self.picking_ids[:1].company_id.id)], limit=1) @@ -78,18 +73,12 @@ def _get_book(self): def _compute_with_vouchers(self): for rec in self: rec.with_vouchers = bool(self.voucher_ids) - - # def do_print_voucher(self): - # self.printed = True - # # if self.book_id: - # # self.book_id = self.book_id.id - # return self.do_print_batch_vouchers() - + def do_print_and_assign(self): # We override the method to avoid assignation if not self.book_id: raise UserError("Primero debe setear un talonario") - if self.book_id.lines_per_voucher != 0: + if not self.book_id.autoprinted: self.printed = True return self.with_context(batch=True).do_print_batch_vouchers() self.assign_numbers(1,self.book_id) diff --git a/stock_batch_picking_voucher/views/stock_batch_picking_views.xml b/stock_batch_picking_voucher/views/stock_batch_picking_views.xml index ef0910632..96f6aaba3 100644 --- a/stock_batch_picking_voucher/views/stock_batch_picking_views.xml +++ b/stock_batch_picking_voucher/views/stock_batch_picking_views.xml @@ -7,8 +7,8 @@ 99 diff --git a/stock_voucher_ux/views/stock_picking_views.xml b/stock_voucher_ux/views/stock_picking_views.xml index 768e0c79c..f08af8926 100644 --- a/stock_voucher_ux/views/stock_picking_views.xml +++ b/stock_voucher_ux/views/stock_picking_views.xml @@ -7,12 +7,16 @@ - -