[ADD] delivery: delivery.carrier must follow the same multi-company rules than the products they reference

This commit is contained in:
Jaykishan Solanki
2017-07-20 15:32:20 +02:00
committed by Richard Mathot
parent b446930dc4
commit 6999d054fc
4 changed files with 16 additions and 0 deletions
+1
View File
@@ -16,6 +16,7 @@ invoices from picking, the system is able to add and compute the shipping line.
'depends': ['sale_stock'],
'data': [
'security/ir.model.access.csv',
'security/delivery_carrier_security.xml',
'views/product_packaging_view.xml',
'views/delivery_view.xml',
'views/partner_view.xml',
@@ -38,6 +38,7 @@ class DeliveryCarrier(models.Model):
delivery_type = fields.Selection([('fixed', 'Fixed Price')], string='Provider', default='fixed', required=True)
integration_level = fields.Selection([('rate', 'Get Rate'), ('rate_and_ship', 'Get Rate and Create Shipment')], string="Integration Level", default='rate_and_ship', help="Action while validating Delivery Orders")
prod_environment = fields.Boolean("Environment", help="Set to True if your credentials are certified for production.")
company_id = fields.Many2one('res.company', string='Company', related='product_id.company_id', store=True)
product_type = fields.Selection(related='product_id.type', default='service')
product_sale_ok = fields.Boolean(related='product_id.sale_ok', default=False)
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<data noupdate="1">
<record model="ir.rule" id="delivery_carrier_comp_rule">
<field name="name">Delivery Carrier multi-company</field>
<field name="model_id" ref="model_delivery_carrier"/>
<field name="global" eval="True"/>
<field name="domain_force"> ['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
</record>
</data>
</odoo>
+3
View File
@@ -88,6 +88,9 @@
<field nolabel="1" name="amount" attrs="{'required':[('free_over','!=', False)], 'invisible':[('free_over','=', False)]}"/>
</div>
</group>
<group>
<field name="company_id"/>
</group>
</group>
<notebook>
<page string="Pricing" attrs="{'invisible': [('delivery_type', 'not in', ['fixed', 'base_on_rule'])]}">