From 172633e7dc38dfbb4533b10fcd61e603691ae489 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 24 Aug 2022 13:37:47 +0700 Subject: fix error compute item margin if unit price < 0 --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d9ef0b85..854a482a 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -92,7 +92,7 @@ class SaleOrderLine(models.Model): def compute_item_margin(self): for line in self: - if not line.product_id or line.price_unit == 0: + if not line.product_id or line.price_unit <= 0: line.item_margin = 0 line.item_percent_margin = 0 continue -- cgit v1.2.3 From acc12eb1eb0e4d0079e380dc6d5a72511a1d79f1 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 25 Aug 2022 09:58:07 +0700 Subject: fix error item margin if down payment invoice --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 854a482a..6f901809 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -92,7 +92,7 @@ class SaleOrderLine(models.Model): def compute_item_margin(self): for line in self: - if not line.product_id or line.price_unit <= 0: + if not line.product_id or line.price_unit <= 0 or line.product_uom_qty <= 0: line.item_margin = 0 line.item_percent_margin = 0 continue -- cgit v1.2.3 From fcd6731bd980731759dca03b1b7c0535fcaeb2a3 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 25 Aug 2022 16:05:19 +0700 Subject: add npwp in purchase order report --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/report/purchase_order.xml | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 indoteknik_custom/report/purchase_order.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 919a61a2..26e0ddb7 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -35,6 +35,7 @@ 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', + 'report/purchase_order.xml' ], 'demo': [], 'css': [], diff --git a/indoteknik_custom/report/purchase_order.xml b/indoteknik_custom/report/purchase_order.xml new file mode 100644 index 00000000..8ad92ee9 --- /dev/null +++ b/indoteknik_custom/report/purchase_order.xml @@ -0,0 +1,9 @@ + + + -- cgit v1.2.3 From a28e01d3df18301057c33930b11655cc9d623b64 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 25 Aug 2022 16:08:55 +0700 Subject: fix typo npwp --- indoteknik_custom/report/purchase_order.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/report/purchase_order.xml b/indoteknik_custom/report/purchase_order.xml index 8ad92ee9..09ded9dc 100644 --- a/indoteknik_custom/report/purchase_order.xml +++ b/indoteknik_custom/report/purchase_order.xml @@ -2,7 +2,7 @@ -- cgit v1.2.3 From b557dfe5249e471a1b7277d5c189313ce303347b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 26 Aug 2022 11:13:23 +0700 Subject: temporary solution for internal use tax --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 2 + indoteknik_custom/models/stock_move.py | 155 +++++++++++++++++++++++++ indoteknik_custom/models/stock_picking.py | 7 ++ indoteknik_custom/views/stock_picking_type.xml | 18 +++ 5 files changed, 183 insertions(+) create mode 100644 indoteknik_custom/models/stock_move.py create mode 100644 indoteknik_custom/models/stock_picking.py create mode 100644 indoteknik_custom/views/stock_picking_type.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 26e0ddb7..c390a7a2 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -32,6 +32,7 @@ 'views/crm_lead.xml', 'views/sale_order.xml', 'views/account_asset_views.xml', + 'views/stock_picking_type.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 25341923..a81306b6 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -19,3 +19,5 @@ from . import sale_monitoring_detail from . import sale_monitoring from . import account_move from . import account_asset +from . import stock_move +from . import stock_picking \ No newline at end of file diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py new file mode 100644 index 00000000..3804198a --- /dev/null +++ b/indoteknik_custom/models/stock_move.py @@ -0,0 +1,155 @@ +from odoo import fields, models, api +from odoo.exceptions import UserError + + +class StockMove(models.Model): + _inherit = 'stock.move' + + def _account_entry_move(self, qty, description, svl_id, cost): + """ Accounting Valuation Entries """ + self.ensure_one() + if self.product_id.type != 'product': + # no stock valuation for consumable products + return False + if self.restrict_partner_id: + # if the move isn't owned by the company, we don't make any valuation + return False + + company_from = self._is_out() and self.mapped('move_line_ids.location_id.company_id') or False + company_to = self._is_in() and self.mapped('move_line_ids.location_dest_id.company_id') or False + + journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation() + # Create Journal Entry for products arriving in the company; in case of routes making the link between several + # warehouse of the same company, the transit location belongs to this company, so we don't need to create accounting entries + if self._is_in(): + if self._is_returned(valued_type='in'): + self.with_company(company_to)._create_account_move_line(acc_dest, acc_valuation, journal_id, qty, + description, svl_id, cost) + else: + self.with_company(company_to)._create_account_move_line(acc_src, acc_valuation, journal_id, qty, + description, svl_id, cost) + + # Create Journal Entry for products leaving the company + if self._is_out(): + cost = -1 * cost + if self._is_returned(valued_type='out'): + self.with_company(company_from)._create_account_move_line(acc_valuation, acc_src, journal_id, qty, + description, svl_id, cost) + else: # custom here for ppn internal use, acc_dest = 538, acc_valuation = 400, charge from virtual location and persediaan + self.with_company(company_from)._create_account_move_line(acc_valuation, acc_dest, journal_id, qty, + description, svl_id, cost) + self.with_company(company_from)._create_account_move_line(440,538,journal_id,qty,description,svl_id,cost * (11 / 100)) + + if self.company_id.anglo_saxon_accounting: + # Creates an account entry from stock_input to stock_output on a dropship move. https://github.com/odoo/odoo/issues/12687 + if self._is_dropshipped(): + if cost > 0: + self.with_company(self.company_id)._create_account_move_line(acc_src, acc_valuation, journal_id, + qty, description, svl_id, cost) + else: + cost = -1 * cost + self.with_company(self.company_id)._create_account_move_line(acc_valuation, acc_dest, journal_id, + qty, description, svl_id, cost) + elif self._is_dropshipped_returned(): + if cost > 0: + self.with_company(self.company_id)._create_account_move_line(acc_valuation, acc_src, journal_id, + qty, description, svl_id, cost) + else: + cost = -1 * cost + self.with_company(self.company_id)._create_account_move_line(acc_dest, acc_valuation, journal_id, + qty, description, svl_id, cost) + + if self.company_id.anglo_saxon_accounting: + # Eventually reconcile together the invoice and valuation accounting entries on the stock interim accounts + self._get_related_invoices()._stock_account_anglo_saxon_reconcile_valuation(product=self.product_id) + + # def _create_account_move_line(self, credit_account_id, debit_account_id, journal_id, qty, description, svl_id, + # cost): + # self.ensure_one() + # AccountMove = self.env['account.move'].with_context(default_journal_id=journal_id) + # + # move_lines = self._prepare_account_move_line(qty, cost, credit_account_id, debit_account_id, description) + # if move_lines: + # date = self._context.get('force_period_date', fields.Date.context_today(self)) + # new_account_move = AccountMove.sudo().create({ + # 'journal_id': journal_id, + # 'line_ids': move_lines, + # 'date': date, + # 'ref': description, + # 'stock_move_id': self.id, + # 'stock_valuation_layer_ids': [(6, None, [svl_id])], + # 'move_type': 'entry', + # }) + # new_account_move._post() + # + # def _prepare_account_move_line(self, qty, cost, credit_account_id, debit_account_id, description): + # """ + # Generate the account.move.line values to post to track the stock valuation difference due to the + # processing of the given quant. + # """ + # self.ensure_one() + # + # # the standard_price of the product may be in another decimal precision, or not compatible with the coinage of + # # the company currency... so we need to use round() before creating the accounting entries. + # debit_value = self.company_id.currency_id.round(cost) + # credit_value = debit_value + # + # valuation_partner_id = self._get_partner_id_for_valuation_lines() + # res = [(0, 0, line_vals) for line_vals in + # self._generate_valuation_lines_data(valuation_partner_id, qty, debit_value, credit_value, + # debit_account_id, credit_account_id, description).values()] + # + # return res + # + # def _generate_valuation_lines_data(self, partner_id, qty, debit_value, credit_value, debit_account_id, + # credit_account_id, description): + # # This method returns a dictionary to provide an easy extension hook to modify the valuation lines (see purchase for an example) + # self.ensure_one() + # debit_line_vals = { + # 'name': description, + # 'product_id': self.product_id.id, + # 'quantity': qty, + # 'product_uom_id': self.product_id.uom_id.id, + # 'ref': description, + # 'partner_id': partner_id, + # 'debit': debit_value if debit_value > 0 else 0, + # 'credit': -debit_value if debit_value < 0 else 0, + # 'account_id': debit_account_id, + # } + # + # credit_line_vals = { + # 'name': description, + # 'product_id': self.product_id.id, + # 'quantity': qty, + # 'product_uom_id': self.product_id.uom_id.id, + # 'ref': description, + # 'partner_id': partner_id, + # 'credit': credit_value if credit_value > 0 else 0, + # 'debit': -credit_value if credit_value < 0 else 0, + # 'account_id': credit_account_id, + # } + # + # rslt = {'credit_line_vals': credit_line_vals, 'debit_line_vals': debit_line_vals} + # if credit_value != debit_value: + # # for supplier returns of product in average costing method, in anglo saxon mode + # diff_amount = debit_value - credit_value + # price_diff_account = self.product_id.property_account_creditor_price_difference + # + # if not price_diff_account: + # price_diff_account = self.product_id.categ_id.property_account_creditor_price_difference_categ + # if not price_diff_account: + # raise UserError( + # _('Configuration error. Please configure the price difference account on the product or its category to process this operation.')) + # + # rslt['price_diff_line_vals'] = { + # 'name': self.name, + # 'product_id': self.product_id.id, + # 'quantity': qty, + # 'product_uom_id': self.product_id.uom_id.id, + # 'ref': description, + # 'partner_id': partner_id, + # 'credit': diff_amount > 0 and diff_amount or 0, + # 'debit': diff_amount < 0 and -diff_amount or 0, + # 'account_id': price_diff_account.id, + # } + # return rslt diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py new file mode 100644 index 00000000..1dfef114 --- /dev/null +++ b/indoteknik_custom/models/stock_picking.py @@ -0,0 +1,7 @@ +from odoo import fields, models, api + + +class StockPicking(models.Model): + _inherit = 'stock.picking.type' + + is_internal_use = fields.Boolean(string="Internal Use") diff --git a/indoteknik_custom/views/stock_picking_type.xml b/indoteknik_custom/views/stock_picking_type.xml new file mode 100644 index 00000000..7a8f45dd --- /dev/null +++ b/indoteknik_custom/views/stock_picking_type.xml @@ -0,0 +1,18 @@ + + + + + Stock Picking Type + stock.picking.type + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 69b4bef9770aaaefd40361acb9ca2b3974e163d5 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 30 Aug 2022 09:26:29 +0700 Subject: add custom field internal use using force save --- indoteknik_custom/models/stock_picking.py | 29 ++++++++++++++++++++++++-- indoteknik_custom/views/stock_picking_type.xml | 17 +++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 1dfef114..1d644090 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1,7 +1,32 @@ from odoo import fields, models, api -class StockPicking(models.Model): +class StockPickingType(models.Model): _inherit = 'stock.picking.type' - is_internal_use = fields.Boolean(string="Internal Use") + + +class StockPicking(models.Model): + _inherit = 'stock.picking' + is_internal_use = fields.Boolean('Internal Use', help="flag which is internal use or not") + + @api.onchange('picking_type_id') + def _onchange_operation_type(self): + test3 = self.picking_type_id.is_internal_use + self.is_internal_use = True + return + # for stock_picking in self: + # test = stock_picking.picking_type_id.is_internal_use + # stock_picking.is_internal_use = stock_picking.picking_type_id.is_internal_use + + # @api.model + # def create(self, vals): + # res = super(StockPicking, self).create(vals) + # test3 = self.picking_type_id.is_internal_use + # self.is_internal_use = True + # return res + + # def _compute_internal_use(self): + # for stock_picking in self: + # test = stock_picking.picking_type_id.is_internal_use + # stock_picking.is_internal_use = stock_picking.picking_type_id.is_internal_use diff --git a/indoteknik_custom/views/stock_picking_type.xml b/indoteknik_custom/views/stock_picking_type.xml index 7a8f45dd..dfc74cad 100644 --- a/indoteknik_custom/views/stock_picking_type.xml +++ b/indoteknik_custom/views/stock_picking_type.xml @@ -15,4 +15,21 @@ + + + Stock Picking + stock.picking + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 57f87cc1da6243d17cba04f9d575f4ca4b836f26 Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Wed, 31 Aug 2022 15:17:40 +0700 Subject: Internal use to account.move (journal) --- indoteknik_custom/__manifest__.py | 3 + indoteknik_custom/models/__init__.py | 3 +- indoteknik_custom/models/stock_move.py | 176 ++++--------------------- indoteknik_custom/models/stock_picking.py | 24 +--- indoteknik_custom/models/stock_picking_type.py | 6 + indoteknik_custom/views/ir_sequence.xml | 12 ++ indoteknik_custom/views/stock_location.xml | 8 ++ indoteknik_custom/views/stock_picking.xml | 23 ++++ indoteknik_custom/views/stock_picking_type.xml | 29 ++-- 9 files changed, 95 insertions(+), 189 deletions(-) create mode 100644 indoteknik_custom/models/stock_picking_type.py create mode 100644 indoteknik_custom/views/ir_sequence.xml create mode 100644 indoteknik_custom/views/stock_location.xml create mode 100644 indoteknik_custom/views/stock_picking.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index c390a7a2..e590df34 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -32,6 +32,9 @@ 'views/crm_lead.xml', 'views/sale_order.xml', 'views/account_asset_views.xml', + 'views/ir_sequence.xml', + 'views/stock_location.xml', + 'views/stock_picking.xml', 'views/stock_picking_type.xml', 'report/report.xml', 'report/report_banner_banner.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index a81306b6..c871a340 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -20,4 +20,5 @@ from . import sale_monitoring from . import account_move from . import account_asset from . import stock_move -from . import stock_picking \ No newline at end of file +from . import stock_picking +from . import stock_picking_type diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 3804198a..c2786762 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -1,155 +1,33 @@ -from odoo import fields, models, api -from odoo.exceptions import UserError +from odoo import fields, models class StockMove(models.Model): _inherit = 'stock.move' - def _account_entry_move(self, qty, description, svl_id, cost): - """ Accounting Valuation Entries """ + def _create_account_move_line(self, credit_account_id, debit_account_id, journal_id, qty, description, svl_id, cost): self.ensure_one() - if self.product_id.type != 'product': - # no stock valuation for consumable products - return False - if self.restrict_partner_id: - # if the move isn't owned by the company, we don't make any valuation - return False - - company_from = self._is_out() and self.mapped('move_line_ids.location_id.company_id') or False - company_to = self._is_in() and self.mapped('move_line_ids.location_dest_id.company_id') or False - - journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation() - # Create Journal Entry for products arriving in the company; in case of routes making the link between several - # warehouse of the same company, the transit location belongs to this company, so we don't need to create accounting entries - if self._is_in(): - if self._is_returned(valued_type='in'): - self.with_company(company_to)._create_account_move_line(acc_dest, acc_valuation, journal_id, qty, - description, svl_id, cost) - else: - self.with_company(company_to)._create_account_move_line(acc_src, acc_valuation, journal_id, qty, - description, svl_id, cost) - - # Create Journal Entry for products leaving the company - if self._is_out(): - cost = -1 * cost - if self._is_returned(valued_type='out'): - self.with_company(company_from)._create_account_move_line(acc_valuation, acc_src, journal_id, qty, - description, svl_id, cost) - else: # custom here for ppn internal use, acc_dest = 538, acc_valuation = 400, charge from virtual location and persediaan - self.with_company(company_from)._create_account_move_line(acc_valuation, acc_dest, journal_id, qty, - description, svl_id, cost) - self.with_company(company_from)._create_account_move_line(440,538,journal_id,qty,description,svl_id,cost * (11 / 100)) - - if self.company_id.anglo_saxon_accounting: - # Creates an account entry from stock_input to stock_output on a dropship move. https://github.com/odoo/odoo/issues/12687 - if self._is_dropshipped(): - if cost > 0: - self.with_company(self.company_id)._create_account_move_line(acc_src, acc_valuation, journal_id, - qty, description, svl_id, cost) - else: - cost = -1 * cost - self.with_company(self.company_id)._create_account_move_line(acc_valuation, acc_dest, journal_id, - qty, description, svl_id, cost) - elif self._is_dropshipped_returned(): - if cost > 0: - self.with_company(self.company_id)._create_account_move_line(acc_valuation, acc_src, journal_id, - qty, description, svl_id, cost) - else: - cost = -1 * cost - self.with_company(self.company_id)._create_account_move_line(acc_dest, acc_valuation, journal_id, - qty, description, svl_id, cost) - - if self.company_id.anglo_saxon_accounting: - # Eventually reconcile together the invoice and valuation accounting entries on the stock interim accounts - self._get_related_invoices()._stock_account_anglo_saxon_reconcile_valuation(product=self.product_id) - - # def _create_account_move_line(self, credit_account_id, debit_account_id, journal_id, qty, description, svl_id, - # cost): - # self.ensure_one() - # AccountMove = self.env['account.move'].with_context(default_journal_id=journal_id) - # - # move_lines = self._prepare_account_move_line(qty, cost, credit_account_id, debit_account_id, description) - # if move_lines: - # date = self._context.get('force_period_date', fields.Date.context_today(self)) - # new_account_move = AccountMove.sudo().create({ - # 'journal_id': journal_id, - # 'line_ids': move_lines, - # 'date': date, - # 'ref': description, - # 'stock_move_id': self.id, - # 'stock_valuation_layer_ids': [(6, None, [svl_id])], - # 'move_type': 'entry', - # }) - # new_account_move._post() - # - # def _prepare_account_move_line(self, qty, cost, credit_account_id, debit_account_id, description): - # """ - # Generate the account.move.line values to post to track the stock valuation difference due to the - # processing of the given quant. - # """ - # self.ensure_one() - # - # # the standard_price of the product may be in another decimal precision, or not compatible with the coinage of - # # the company currency... so we need to use round() before creating the accounting entries. - # debit_value = self.company_id.currency_id.round(cost) - # credit_value = debit_value - # - # valuation_partner_id = self._get_partner_id_for_valuation_lines() - # res = [(0, 0, line_vals) for line_vals in - # self._generate_valuation_lines_data(valuation_partner_id, qty, debit_value, credit_value, - # debit_account_id, credit_account_id, description).values()] - # - # return res - # - # def _generate_valuation_lines_data(self, partner_id, qty, debit_value, credit_value, debit_account_id, - # credit_account_id, description): - # # This method returns a dictionary to provide an easy extension hook to modify the valuation lines (see purchase for an example) - # self.ensure_one() - # debit_line_vals = { - # 'name': description, - # 'product_id': self.product_id.id, - # 'quantity': qty, - # 'product_uom_id': self.product_id.uom_id.id, - # 'ref': description, - # 'partner_id': partner_id, - # 'debit': debit_value if debit_value > 0 else 0, - # 'credit': -debit_value if debit_value < 0 else 0, - # 'account_id': debit_account_id, - # } - # - # credit_line_vals = { - # 'name': description, - # 'product_id': self.product_id.id, - # 'quantity': qty, - # 'product_uom_id': self.product_id.uom_id.id, - # 'ref': description, - # 'partner_id': partner_id, - # 'credit': credit_value if credit_value > 0 else 0, - # 'debit': -credit_value if credit_value < 0 else 0, - # 'account_id': credit_account_id, - # } - # - # rslt = {'credit_line_vals': credit_line_vals, 'debit_line_vals': debit_line_vals} - # if credit_value != debit_value: - # # for supplier returns of product in average costing method, in anglo saxon mode - # diff_amount = debit_value - credit_value - # price_diff_account = self.product_id.property_account_creditor_price_difference - # - # if not price_diff_account: - # price_diff_account = self.product_id.categ_id.property_account_creditor_price_difference_categ - # if not price_diff_account: - # raise UserError( - # _('Configuration error. Please configure the price difference account on the product or its category to process this operation.')) - # - # rslt['price_diff_line_vals'] = { - # 'name': self.name, - # 'product_id': self.product_id.id, - # 'quantity': qty, - # 'product_uom_id': self.product_id.uom_id.id, - # 'ref': description, - # 'partner_id': partner_id, - # 'credit': diff_amount > 0 and diff_amount or 0, - # 'debit': diff_amount < 0 and -diff_amount or 0, - # 'account_id': price_diff_account.id, - # } - # return rslt + if self.picking_id.is_internal_use: + AccountMove = self.env['account.move'].with_context(default_journal_id=journal_id) + + # 538 is static id for "Biaya Umum Lain-Lain" on account.account model + # 440 is static id for "PPN Keluaran" on account.account model + debit_account_id = self.picking_id.account_id.id if self.picking_id.account_id.id else 538 + + tax = cost * (11 / 100) + move_lines = self._prepare_account_move_line(qty, cost, credit_account_id, debit_account_id, description) + move_lines += self._prepare_account_move_line(qty, tax, 440, debit_account_id, description) + + if move_lines: + date = self._context.get('force_period_date', fields.Date.context_today(self)) + new_account_move = AccountMove.sudo().create({ + 'journal_id': journal_id, + 'line_ids': move_lines, + 'date': date, + 'ref': description, + 'stock_move_id': self.id, + 'stock_valuation_layer_ids': [(6, None, [svl_id])], + 'move_type': 'entry', + }) + new_account_move._post() + return True + return super(StockMove, self)._create_account_move_line(credit_account_id, debit_account_id, journal_id, qty, description, svl_id, cost) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 1d644090..9b5f0036 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1,32 +1,12 @@ from odoo import fields, models, api -class StockPickingType(models.Model): - _inherit = 'stock.picking.type' - is_internal_use = fields.Boolean(string="Internal Use") - - class StockPicking(models.Model): _inherit = 'stock.picking' is_internal_use = fields.Boolean('Internal Use', help="flag which is internal use or not") + account_id = fields.Many2one('account.account', string="Account") @api.onchange('picking_type_id') def _onchange_operation_type(self): - test3 = self.picking_type_id.is_internal_use - self.is_internal_use = True + self.is_internal_use = self.picking_type_id.is_internal_use return - # for stock_picking in self: - # test = stock_picking.picking_type_id.is_internal_use - # stock_picking.is_internal_use = stock_picking.picking_type_id.is_internal_use - - # @api.model - # def create(self, vals): - # res = super(StockPicking, self).create(vals) - # test3 = self.picking_type_id.is_internal_use - # self.is_internal_use = True - # return res - - # def _compute_internal_use(self): - # for stock_picking in self: - # test = stock_picking.picking_type_id.is_internal_use - # stock_picking.is_internal_use = stock_picking.picking_type_id.is_internal_use diff --git a/indoteknik_custom/models/stock_picking_type.py b/indoteknik_custom/models/stock_picking_type.py new file mode 100644 index 00000000..064946ed --- /dev/null +++ b/indoteknik_custom/models/stock_picking_type.py @@ -0,0 +1,6 @@ +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = 'stock.picking.type' + is_internal_use = fields.Boolean(string="Internal Use") diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml new file mode 100644 index 00000000..9e057c0d --- /dev/null +++ b/indoteknik_custom/views/ir_sequence.xml @@ -0,0 +1,12 @@ + + + + Internal Use + internal.use + TRUE + IU/%(year)s/ + 5 + 1 + 1 + + \ No newline at end of file diff --git a/indoteknik_custom/views/stock_location.xml b/indoteknik_custom/views/stock_location.xml new file mode 100644 index 00000000..82ab2bc5 --- /dev/null +++ b/indoteknik_custom/views/stock_location.xml @@ -0,0 +1,8 @@ + + + + Internal Use + 3 + inventory + + \ No newline at end of file diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml new file mode 100644 index 00000000..d2c1b26f --- /dev/null +++ b/indoteknik_custom/views/stock_picking.xml @@ -0,0 +1,23 @@ + + + + + Stock Picking + stock.picking + + + + + + + + + + + + \ No newline at end of file diff --git a/indoteknik_custom/views/stock_picking_type.xml b/indoteknik_custom/views/stock_picking_type.xml index dfc74cad..deb6d112 100644 --- a/indoteknik_custom/views/stock_picking_type.xml +++ b/indoteknik_custom/views/stock_picking_type.xml @@ -1,6 +1,18 @@ + + Internal Use + + 2 + TRUE + outgoing + TRUE + 10 + 18 + + + Stock Picking Type stock.picking.type @@ -15,21 +27,4 @@ - - - Stock Picking - stock.picking - - - - - - - - \ No newline at end of file -- cgit v1.2.3 From e06fd148cb6872b1e9d864e16e63b845b5bb8878 Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Wed, 31 Aug 2022 16:07:56 +0700 Subject: Fix picking type --- indoteknik_custom/views/stock_picking_type.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/views/stock_picking_type.xml b/indoteknik_custom/views/stock_picking_type.xml index deb6d112..1633c57a 100644 --- a/indoteknik_custom/views/stock_picking_type.xml +++ b/indoteknik_custom/views/stock_picking_type.xml @@ -4,6 +4,7 @@ Internal Use + IU/%(year)s 2 TRUE outgoing -- cgit v1.2.3 From 1e8c8cf61497f7bc67b8282c34641474107e9d8e Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Wed, 31 Aug 2022 16:32:02 +0700 Subject: Add field account_id condition show and required when internal_use --- indoteknik_custom/views/stock_picking.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index d2c1b26f..9081a58e 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -15,7 +15,13 @@ /> - + -- cgit v1.2.3