mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-27 05:32:04 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import sale_order
|
||||
from . import crm_team
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Copyright (C) 2019 Open Source Integrators
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class CrmTeam(models.Model):
|
||||
_inherit = "crm.team"
|
||||
|
||||
brand_id = fields.Many2one(comodel_name="res.brand", string="Brand")
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Copyright (C) 2019 Open Source Integrators
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_name = "sale.order"
|
||||
_inherit = ["sale.order", "res.brand.mixin"]
|
||||
|
||||
brand_id = fields.Many2one()
|
||||
|
||||
def _prepare_invoice(self):
|
||||
invoice_vals = {}
|
||||
for order in self:
|
||||
invoice_vals = super(SaleOrder, order)._prepare_invoice()
|
||||
invoice_vals.update({"brand_id": order.brand_id.id})
|
||||
return invoice_vals
|
||||
|
||||
@api.onchange("team_id")
|
||||
def _onchange_team_id(self):
|
||||
if self.team_id.brand_id:
|
||||
self.brand_id = self.team_id.brand_id
|
||||
|
||||
def default_get(self, fields_list):
|
||||
res = super().default_get(fields_list)
|
||||
|
||||
if res.get("team_id", False) and not res.get("brand_id", False):
|
||||
team = self.env["crm.team"].browse(res["team_id"])
|
||||
res["brand_id"] = team.brand_id.id
|
||||
|
||||
return res
|
||||
Loading…
Add table
Add a link
Reference in a new issue