mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 13:32:03 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -1,15 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class PosConfig(models.Model):
|
||||
_inherit = 'pos.config'
|
||||
|
||||
crm_team_id = fields.Many2one(
|
||||
'crm.team', string="Sales Team", ondelete="set null",
|
||||
'crm.team', string="Sales Team", ondelete="set null", index='btree_not_null',
|
||||
help="This Point of sale's sales will be related to this Sales Team.")
|
||||
down_payment_product_id = fields.Many2one('product.product',
|
||||
string="Down Payment Product",
|
||||
help="This product will be used as down payment on a sale order.")
|
||||
|
||||
def _get_special_products(self):
|
||||
res = super()._get_special_products()
|
||||
return res | self.env['pos.config'].search([]).mapped('down_payment_product_id')
|
||||
|
||||
@api.model
|
||||
def _ensure_downpayment_product(self):
|
||||
pos_config = self.env.ref('point_of_sale.pos_config_main', raise_if_not_found=False)
|
||||
downpayment_product = self.env.ref('pos_sale.default_downpayment_product', raise_if_not_found=False)
|
||||
if pos_config and downpayment_product:
|
||||
pos_config.write({'down_payment_product_id': downpayment_product.id})
|
||||
|
||||
@api.model
|
||||
def load_onboarding_furniture_scenario(self, with_demo_data=True):
|
||||
res = super().load_onboarding_furniture_scenario(with_demo_data)
|
||||
self._ensure_downpayment_product()
|
||||
return res
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue