Master purchase indent
This commit is contained in:
parent
1d4dae4cb4
commit
887dec3ed5
@ -5,4 +5,3 @@
|
|||||||
from . import res_branch
|
from . import res_branch
|
||||||
from . import ir_branch_company
|
from . import ir_branch_company
|
||||||
from . import res_partner
|
from . import res_partner
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from flectra import api, fields, models
|
from flectra import api, fields, models
|
||||||
|
# from flectra.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class Company(models.Model):
|
class Company(models.Model):
|
||||||
@ -22,6 +23,7 @@ class Company(models.Model):
|
|||||||
'company_id': company.id})
|
'company_id': company.id})
|
||||||
return company
|
return company
|
||||||
|
|
||||||
|
|
||||||
class ResBranch(models.Model):
|
class ResBranch(models.Model):
|
||||||
_name = "res.branch"
|
_name = "res.branch"
|
||||||
|
|
||||||
@ -45,7 +47,8 @@ class ResBranch(models.Model):
|
|||||||
phone = fields.Char()
|
phone = fields.Char()
|
||||||
mobile = fields.Char()
|
mobile = fields.Char()
|
||||||
|
|
||||||
_sql_constraints = [('branch_code_company_uniq', 'unique (code,company_id)',
|
_sql_constraints = [('branch_code_company_uniq',
|
||||||
|
'unique (code,company_id)',
|
||||||
'The branch code must be unique per company!')]
|
'The branch code must be unique per company!')]
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@ -109,13 +112,23 @@ class Users(models.Model):
|
|||||||
default=_get_branch,
|
default=_get_branch,
|
||||||
domain="[('company_id','=',company_id)"
|
domain="[('company_id','=',company_id)"
|
||||||
"]")
|
"]")
|
||||||
branches_count = fields.Integer(compute='_compute_branches_count',
|
branches_count = fields.Integer(
|
||||||
string="Number of Companies",
|
compute='_compute_branches_count',
|
||||||
default=_branches_count)
|
string="Number of Companies", default=_branches_count)
|
||||||
|
|
||||||
|
# To do : Check with all base module test cases
|
||||||
|
# @api.multi
|
||||||
|
# @api.constrains('default_branch_id', 'branch_ids')
|
||||||
|
# def _check_branches(self):
|
||||||
|
# for user in self:
|
||||||
|
# if user.branch_ids \
|
||||||
|
# and user.default_branch_id not in user.branch_ids:
|
||||||
|
# raise ValidationError(_('The selected Default Branch (%s) '
|
||||||
|
# 'is not in the Branches!') % (
|
||||||
|
# user.default_branch_id.name))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_branches_count(self):
|
def _compute_branches_count(self):
|
||||||
branches_count = self._branches_count()
|
branches_count = self._branches_count()
|
||||||
for user in self:
|
for user in self:
|
||||||
user.branches_count = branches_count
|
user.branches_count = branches_count
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from flectra import api, fields, models
|
from flectra import api, models
|
||||||
|
|
||||||
|
|
||||||
class Partner(models.Model):
|
class Partner(models.Model):
|
||||||
_name = "res.partner"
|
_name = "res.partner"
|
||||||
@ -17,6 +18,3 @@ class Partner(models.Model):
|
|||||||
self.branch_id.with_context(ctx).write(branch_vals)
|
self.branch_id.with_context(ctx).write(branch_vals)
|
||||||
result = super(Partner, self).write(vals)
|
result = super(Partner, self).write(vals)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from flectra.tests.common import TransactionCase
|
|||||||
import logging
|
import logging
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TestMultiBranch(TransactionCase):
|
class TestMultiBranch(TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestMultiBranch, self).setUp()
|
super(TestMultiBranch, self).setUp()
|
||||||
@ -14,10 +15,11 @@ class TestMultiBranch(TransactionCase):
|
|||||||
self.branch0 = self.env.ref('base_branch_company.data_branch_1')
|
self.branch0 = self.env.ref('base_branch_company.data_branch_1')
|
||||||
self.branch1 = self.env.ref('base_branch_company.data_branch_2')
|
self.branch1 = self.env.ref('base_branch_company.data_branch_2')
|
||||||
|
|
||||||
self.user_1 = self.create_user(self.main_company, 'user_1', self.branch0,
|
self.user_1 = self.create_user(
|
||||||
|
self.main_company, 'user_1', self.branch0,
|
||||||
[self.branch0, self.branch1])
|
[self.branch0, self.branch1])
|
||||||
self.user_2 = self.create_user(self.main_company, 'user_2', self.branch1,
|
self.user_2 = self.create_user(
|
||||||
[self.branch1])
|
self.main_company, 'user_2', self.branch1, [self.branch1])
|
||||||
|
|
||||||
self.model_id = \
|
self.model_id = \
|
||||||
self.env['ir.model'].search([('model', '=', 'res.partner')])
|
self.env['ir.model'].search([('model', '=', 'res.partner')])
|
||||||
@ -45,7 +47,7 @@ class TestMultiBranch(TransactionCase):
|
|||||||
def create_user(self, main_company, user_name, branch_id, branch_ids):
|
def create_user(self, main_company, user_name, branch_id, branch_ids):
|
||||||
data = {
|
data = {
|
||||||
'company_ids': [(4, main_company.id)],
|
'company_ids': [(4, main_company.id)],
|
||||||
'branch_ids': [(4, branch_id.id) for branch_id in branch_ids],
|
'branch_ids': [(4, branch.id) for branch in branch_ids],
|
||||||
'company_id': main_company.id,
|
'company_id': main_company.id,
|
||||||
'default_branch_id': branch_id.id,
|
'default_branch_id': branch_id.id,
|
||||||
'login': user_name,
|
'login': user_name,
|
||||||
@ -57,24 +59,17 @@ class TestMultiBranch(TransactionCase):
|
|||||||
user_obj = self.env['res.users'].create(data)
|
user_obj = self.env['res.users'].create(data)
|
||||||
return user_obj
|
return user_obj
|
||||||
|
|
||||||
|
|
||||||
def test_user_authentication(self):
|
def test_user_authentication(self):
|
||||||
partner = self.partner_obj.sudo(self.user_1.id).search(
|
partner = self.partner_obj.sudo(self.user_1.id).search(
|
||||||
[('id', '=', self.branch_partner1.id),
|
[('id', '=', self.branch_partner1.id),
|
||||||
('branch_id', '=', self.branch0.id)])
|
('branch_id', '=', self.branch0.id)])
|
||||||
self.assertNotEqual(partner.ids, [], 'Test User have access to '
|
self.assertNotEqual(partner.ids, [],
|
||||||
'Branch %s' % self.branch0.name)
|
'Test User have access to Branch %s' %
|
||||||
|
self.branch0.name)
|
||||||
|
|
||||||
partner = self.partner_obj.sudo(self.user_2.id).search(
|
partner = self.partner_obj.sudo(self.user_2.id).search(
|
||||||
[('id', '=', self.branch_partner0.id),
|
[('id', '=', self.branch_partner0.id),
|
||||||
('branch_id', '=', self.branch0.id)])
|
('branch_id', '=', self.branch0.id)])
|
||||||
self.assertEqual(partner.ids, [],
|
self.assertEqual(partner.ids, [],
|
||||||
'Test User should not have access to '
|
'Test User should not have access to Branch %s' %
|
||||||
'Branch %s' % self.branch0.name)
|
self.branch0.name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
<xpath expr="//page[@name='access_rights']/group[1]" position="after">
|
<xpath expr="//page[@name='access_rights']/group[1]" position="after">
|
||||||
<group groups="base_branch_company.group_multi_branch">
|
<group groups="base_branch_company.group_multi_branch">
|
||||||
<group string="Allowed Branches" attrs="{'invisible': [('branches_count', '<=', 1)]}">
|
<group string="Allowed Branches" attrs="{'invisible': [('branches_count', '<=', 1)]}">
|
||||||
<field name="default_branch_id"/>
|
<field name="default_branch_id" required="1"/>
|
||||||
<field name="branch_ids" widget="many2many_tags"/>
|
<field name="branch_ids" widget="many2many_tags"/>
|
||||||
<field string="Branches count" name="branches_count" invisible="1"/>
|
<field string="Branches count" name="branches_count" invisible="1"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -70,7 +70,11 @@ class PurchaseOrder(models.Model):
|
|||||||
def _default_picking_type(self):
|
def _default_picking_type(self):
|
||||||
type_obj = self.env['stock.picking.type']
|
type_obj = self.env['stock.picking.type']
|
||||||
company_id = self.env.context.get('company_id') or self.env.user.company_id.id
|
company_id = self.env.context.get('company_id') or self.env.user.company_id.id
|
||||||
types = type_obj.search([('code', '=', 'incoming'), ('warehouse_id.company_id', '=', company_id)])
|
branch_id = self.env.context.get(
|
||||||
|
'branch_id') or self.env.user.default_branch_id.id
|
||||||
|
types = type_obj.search([('code', '=', 'incoming'),
|
||||||
|
('warehouse_id.company_id', '=', company_id),
|
||||||
|
('warehouse_id.branch_id', '=', branch_id)])
|
||||||
if not types:
|
if not types:
|
||||||
types = type_obj.search([('code', '=', 'incoming'), ('warehouse_id', '=', False)])
|
types = type_obj.search([('code', '=', 'incoming'), ('warehouse_id', '=', False)])
|
||||||
return types[:1]
|
return types[:1]
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<field name="product_qty">2</field>
|
<field name="product_qty">2</field>
|
||||||
<field name="remaining_qty">2.0</field>
|
<field name="remaining_qty">2.0</field>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
|
<field name="branch_id" ref="base_branch_company.data_branch_2"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="purchase.indent" name="action_confirm"
|
<function model="purchase.indent" name="action_confirm"
|
||||||
|
@ -204,7 +204,7 @@ msgid "Group By"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: purchase_indent
|
#. module: purchase_indent
|
||||||
#: model:ir.model.fields,field_description:purchase_indent.field_purchase_indent_intend_history_ids
|
#: model:ir.model.fields,field_description:purchase_indent.field_purchase_indent_indent_history_ids
|
||||||
#: model:ir.ui.view,arch_db:purchase_indent.view_purchase_indent_form
|
#: model:ir.ui.view,arch_db:purchase_indent.view_purchase_indent_form
|
||||||
msgid "History"
|
msgid "History"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from flectra.exceptions import Warning, AccessError
|
from flectra.exceptions import Warning, AccessError, ValidationError
|
||||||
from flectra.tools.misc import formatLang
|
from flectra.tools.misc import formatLang
|
||||||
|
|
||||||
import flectra.addons.decimal_precision as dp
|
import flectra.addons.decimal_precision as dp
|
||||||
@ -167,6 +167,7 @@ class PurchaseRequisition(models.Model):
|
|||||||
|
|
||||||
purchase_indent_ids = fields.Many2many(
|
purchase_indent_ids = fields.Many2many(
|
||||||
'purchase.indent', string='Purchase Indent')
|
'purchase.indent', string='Purchase Indent')
|
||||||
|
branch_id = fields.Many2one('res.branch', string="Branch")
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_draft(self):
|
def action_draft(self):
|
||||||
@ -205,18 +206,21 @@ class PurchaseRequisitionLine(models.Model):
|
|||||||
'purchase.indent.line', 'Purchase Indent Line Ref')
|
'purchase.indent.line', 'Purchase Indent Line Ref')
|
||||||
purchase_indent_ids = fields.Many2many(
|
purchase_indent_ids = fields.Many2many(
|
||||||
'purchase.indent', string='Purchase Indent')
|
'purchase.indent', string='Purchase Indent')
|
||||||
|
branch_id = fields.Many2one(related='requisition_id.branch_id',
|
||||||
|
string='Branch', store=True)
|
||||||
|
|
||||||
|
|
||||||
class PurchaseIndent(models.Model):
|
class PurchaseIndent(models.Model):
|
||||||
_name = 'purchase.indent'
|
_name = 'purchase.indent'
|
||||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
_inherit = ['mail.thread', 'mail.activity.mixin',
|
||||||
|
'ir.branch.company.mixin']
|
||||||
_description = "Purchase Indent"
|
_description = "Purchase Indent"
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_order_count(self):
|
def _compute_order_count(self):
|
||||||
po_list = []
|
po_list = []
|
||||||
pa_list = []
|
pa_list = []
|
||||||
for history_id in self.intend_history_ids:
|
for history_id in self.indent_history_ids:
|
||||||
if history_id.order_id:
|
if history_id.order_id:
|
||||||
po_list.append(history_id.order_id.id)
|
po_list.append(history_id.order_id.id)
|
||||||
elif history_id.purchase_requisition_id:
|
elif history_id.purchase_requisition_id:
|
||||||
@ -260,7 +264,7 @@ class PurchaseIndent(models.Model):
|
|||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one(
|
||||||
'res.partner', related='user_id.partner_id',
|
'res.partner', related='user_id.partner_id',
|
||||||
string="Partner", track_visibility='onchange')
|
string="Partner", track_visibility='onchange')
|
||||||
intend_history_ids = fields.One2many(
|
indent_history_ids = fields.One2many(
|
||||||
'purchase.indent.history', 'purchase_indent_id', 'History')
|
'purchase.indent.history', 'purchase_indent_id', 'History')
|
||||||
purchase_order_count = fields.Integer(
|
purchase_order_count = fields.Integer(
|
||||||
compute='_compute_order_count', string='# of Purchase Order')
|
compute='_compute_order_count', string='# of Purchase Order')
|
||||||
@ -280,20 +284,34 @@ class PurchaseIndent(models.Model):
|
|||||||
help="Technical field used to display the Drop Ship Address",
|
help="Technical field used to display the Drop Ship Address",
|
||||||
readonly=True)
|
readonly=True)
|
||||||
|
|
||||||
|
@api.constrains('company_id', 'branch_id')
|
||||||
|
def _check_company(self):
|
||||||
|
for order in self:
|
||||||
|
if order.branch_id \
|
||||||
|
and order.company_id != order.branch_id.company_id:
|
||||||
|
raise ValidationError(
|
||||||
|
_('Configuration Error of Company:\n'
|
||||||
|
'The Purchase Indent Company (%s) and '
|
||||||
|
'the Company (%s) of Branch must '
|
||||||
|
'be the same company!') % (
|
||||||
|
order.company_id.name,
|
||||||
|
order.branch_id.company_id.name)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def set_qty_state_cancel(self, purchase_order_id=False,
|
def set_qty_state_cancel(self, purchase_order_id=False,
|
||||||
purchase_agreement_id=False):
|
purchase_agreement_id=False):
|
||||||
intend_history_ids = []
|
indent_history_ids = []
|
||||||
indent_line_obj = self.env['purchase.indent.line']
|
indent_line_obj = self.env['purchase.indent.line']
|
||||||
if purchase_order_id:
|
if purchase_order_id:
|
||||||
intend_history_ids = self.env['purchase.indent.history'].search([
|
indent_history_ids = self.env['purchase.indent.history'].search([
|
||||||
('order_id', '=', purchase_order_id.id),
|
('order_id', '=', purchase_order_id.id),
|
||||||
('purchase_requisition_id', '=', False)])
|
('purchase_requisition_id', '=', False)])
|
||||||
elif purchase_agreement_id:
|
elif purchase_agreement_id:
|
||||||
intend_history_ids = self.env['purchase.indent.history'].search([
|
indent_history_ids = self.env['purchase.indent.history'].search([
|
||||||
('order_id', '=', False),
|
('order_id', '=', False),
|
||||||
('purchase_requisition_id', '=', purchase_agreement_id.id)])
|
('purchase_requisition_id', '=', purchase_agreement_id.id)])
|
||||||
for history_id in intend_history_ids:
|
for history_id in indent_history_ids:
|
||||||
indent_line_id = indent_line_obj.sudo().search([
|
indent_line_id = indent_line_obj.sudo().search([
|
||||||
('product_id', '=', history_id.product_id.id),
|
('product_id', '=', history_id.product_id.id),
|
||||||
('purchase_indent_id', '=', history_id.purchase_indent_id.id)])
|
('purchase_indent_id', '=', history_id.purchase_indent_id.id)])
|
||||||
@ -307,16 +325,16 @@ class PurchaseIndent(models.Model):
|
|||||||
def set_qty_state_confirm(self, purchase_order_id=False,
|
def set_qty_state_confirm(self, purchase_order_id=False,
|
||||||
purchase_agreement_id=False):
|
purchase_agreement_id=False):
|
||||||
indent_line_obj = self.env['purchase.indent.line']
|
indent_line_obj = self.env['purchase.indent.line']
|
||||||
intend_history_ids = []
|
indent_history_ids = []
|
||||||
if purchase_order_id:
|
if purchase_order_id:
|
||||||
intend_history_ids = self.env['purchase.indent.history'].search([
|
indent_history_ids = self.env['purchase.indent.history'].search([
|
||||||
('order_id', '=', purchase_order_id.id),
|
('order_id', '=', purchase_order_id.id),
|
||||||
('state', '=', 'Cancelled')])
|
('state', '=', 'Cancelled')])
|
||||||
elif purchase_agreement_id:
|
elif purchase_agreement_id:
|
||||||
intend_history_ids = self.env['purchase.indent.history'].search([
|
indent_history_ids = self.env['purchase.indent.history'].search([
|
||||||
('purchase_requisition_id', '=', purchase_agreement_id.id),
|
('purchase_requisition_id', '=', purchase_agreement_id.id),
|
||||||
('state', '=', 'Cancelled')])
|
('state', '=', 'Cancelled')])
|
||||||
for history_id in intend_history_ids:
|
for history_id in indent_history_ids:
|
||||||
indent_line_id = indent_line_obj.sudo().search([
|
indent_line_id = indent_line_obj.sudo().search([
|
||||||
('product_id', '=', history_id.product_id.id),
|
('product_id', '=', history_id.product_id.id),
|
||||||
('purchase_indent_id', '=', history_id.purchase_indent_id.id)])
|
('purchase_indent_id', '=', history_id.purchase_indent_id.id)])
|
||||||
@ -442,7 +460,7 @@ class PurchaseIndent(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def get_purchase_order_list(self):
|
def get_purchase_order_list(self):
|
||||||
order_list = [
|
order_list = [
|
||||||
history_id.order_id.id for history_id in self.intend_history_ids]
|
history_id.order_id.id for history_id in self.indent_history_ids]
|
||||||
return {
|
return {
|
||||||
'name': 'Purchase Orders',
|
'name': 'Purchase Orders',
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
@ -455,7 +473,7 @@ class PurchaseIndent(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def get_purchase_agreement_list(self):
|
def get_purchase_agreement_list(self):
|
||||||
pr_list = [history_id.purchase_requisition_id.id
|
pr_list = [history_id.purchase_requisition_id.id
|
||||||
for history_id in self.intend_history_ids]
|
for history_id in self.indent_history_ids]
|
||||||
return {
|
return {
|
||||||
'name': 'Purchase Agreements',
|
'name': 'Purchase Agreements',
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
@ -528,6 +546,8 @@ class PurchaseIndentLine(models.Model):
|
|||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
'res.company', related='purchase_indent_id.company_id',
|
'res.company', related='purchase_indent_id.company_id',
|
||||||
string='Company', store=True, readonly=True)
|
string='Company', store=True, readonly=True)
|
||||||
|
branch_id = fields.Many2one(related='purchase_indent_id.branch_id',
|
||||||
|
string='Branch', store=True)
|
||||||
requisition_qty = fields.Float(
|
requisition_qty = fields.Float(
|
||||||
string="Requisition Quantity",
|
string="Requisition Quantity",
|
||||||
digits=dp.get_precision('Discount'))
|
digits=dp.get_precision('Discount'))
|
||||||
@ -599,6 +619,10 @@ class PurchaseIndentHistory(models.Model):
|
|||||||
self_id.product_qty - self_id.requisition_qty
|
self_id.product_qty - self_id.requisition_qty
|
||||||
|
|
||||||
purchase_indent_id = fields.Many2one('purchase.indent', 'Purchase Indent')
|
purchase_indent_id = fields.Many2one('purchase.indent', 'Purchase Indent')
|
||||||
|
branch_id = fields.Many2one(related='purchase_indent_id.branch_id',
|
||||||
|
string='Branch', store=True)
|
||||||
|
company_id = fields.Many2one(related='purchase_indent_id.company_id',
|
||||||
|
string="Company", store=True)
|
||||||
product_id = fields.Many2one(
|
product_id = fields.Many2one(
|
||||||
'product.product', string='Product',
|
'product.product', string='Product',
|
||||||
domain=[('purchase_ok', '=', True)],
|
domain=[('purchase_ok', '=', True)],
|
||||||
|
@ -54,6 +54,10 @@
|
|||||||
<strong>Category:</strong>
|
<strong>Category:</strong>
|
||||||
<p t-field="o.category_id.name"/>
|
<p t-field="o.category_id.name"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div t-if="o.branch_id" class="col-xs-3">
|
||||||
|
<strong>Branch:</strong>
|
||||||
|
<p t-field="o.branch_id.name"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table width="100%" class="table table-striped table-bordered"
|
<table width="100%" class="table table-striped table-bordered"
|
||||||
border="1">
|
border="1">
|
||||||
|
@ -20,4 +20,26 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- Multi Branch -->
|
||||||
|
|
||||||
|
<record model="ir.rule" id="purchase_indent_multi_branch_rule">
|
||||||
|
<field name="name">Purchase Indent multi-branch</field>
|
||||||
|
<field name="model_id" ref="model_purchase_indent"/>
|
||||||
|
<field name="global" eval="True"/>
|
||||||
|
<field name="domain_force">
|
||||||
|
['|', ('branch_id', '=', False), '|', ('branch_id', '=', user.default_branch_id.id),
|
||||||
|
('branch_id', 'in', user.branch_ids.ids)]
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.rule" id="purchase_indent_line_multi_branch_rule">
|
||||||
|
<field name="name">Purchase Indent Line multi-branch</field>
|
||||||
|
<field name="model_id" ref="model_purchase_indent_line"/>
|
||||||
|
<field name="global" eval="True"/>
|
||||||
|
<field name="domain_force">
|
||||||
|
['|', ('branch_id', '=', False), '|', ('branch_id', '=', user.default_branch_id.id),
|
||||||
|
('branch_id', 'in', user.branch_ids.ids)]
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</flectra>
|
</flectra>
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from flectra.exceptions import Warning
|
from flectra.exceptions import Warning
|
||||||
from flectra.tests.common import TransactionCase
|
from flectra.tests.common import TransactionCase
|
||||||
from flectra.tools.misc import formatLang
|
from flectra.tools.misc import formatLang
|
||||||
|
|
||||||
from flectra import _
|
from flectra import _
|
||||||
|
|
||||||
|
|
||||||
@ -17,22 +15,30 @@ class TestPurchaseIndent(TransactionCase):
|
|||||||
self.PurchaseIndent = self.env['purchase.indent']
|
self.PurchaseIndent = self.env['purchase.indent']
|
||||||
self.PurchaseIndentLine = self.env['purchase.indent.line']
|
self.PurchaseIndentLine = self.env['purchase.indent.line']
|
||||||
self.Requisition_Req = self.env['wiz.requisition.request']
|
self.Requisition_Req = self.env['wiz.requisition.request']
|
||||||
|
self.company_id = self.env.ref('base.main_company')
|
||||||
def test_00_purchase_indent_flow(self):
|
self.branch_id = self.env.ref('base_branch_company.data_branch_2')
|
||||||
self.partner_id = self.env.ref('base.res_partner_address_12')
|
self.partner_id = self.env.ref('base.res_partner_address_12')
|
||||||
self.category_id = self.env.ref('product.product_category_5')
|
self.category_id = self.env.ref('product.product_category_5')
|
||||||
self.product_id_1 = self.env.ref('product.product_product_24')
|
self.product_id_1 = self.env.ref('product.product_product_24')
|
||||||
self.product_id_2 = self.env.ref('product.product_product_16')
|
self.product_id_2 = self.env.ref('product.product_product_16')
|
||||||
self.product_id_3 = self.env.ref('product.consu_delivery_03')
|
self.product_id_3 = self.env.ref('product.consu_delivery_03')
|
||||||
self.company_id = self.env.ref('base.main_company')
|
|
||||||
self.agreement_type_id = \
|
self.agreement_type_id = \
|
||||||
self.env.ref('purchase_requisition.type_multi')
|
self.env.ref('purchase_requisition.type_multi')
|
||||||
|
|
||||||
purchase_indent_vals_1 = {
|
purchase_indent_vals = {
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'category_id': self.category_id.id,
|
'category_id': self.category_id.id,
|
||||||
'request_date': datetime.today(),
|
'request_date': datetime.today(),
|
||||||
'user_id': self.env.user.id,
|
'user_id': self.env.user.id,
|
||||||
|
'branch_id': self.branch_id.id
|
||||||
|
}
|
||||||
|
|
||||||
|
self.purchase_indent_id = \
|
||||||
|
self.PurchaseIndent.create(purchase_indent_vals)
|
||||||
|
self.purchase_indent_id_1 = self.purchase_indent_id.copy()
|
||||||
|
|
||||||
|
def test_00_purchase_indent_flow(self):
|
||||||
|
self.purchase_indent_id.write({
|
||||||
'indent_line': [
|
'indent_line': [
|
||||||
(0, 0, {
|
(0, 0, {
|
||||||
'name': self.product_id_1.name,
|
'name': self.product_id_1.name,
|
||||||
@ -46,13 +52,9 @@ class TestPurchaseIndent(TransactionCase):
|
|||||||
'product_qty': 15.0,
|
'product_qty': 15.0,
|
||||||
'product_uom': self.product_id_2.uom_po_id.id,
|
'product_uom': self.product_id_2.uom_po_id.id,
|
||||||
})],
|
})],
|
||||||
}
|
})
|
||||||
|
|
||||||
purchase_indent_vals_2 = {
|
self.purchase_indent_id_1.write({
|
||||||
'company_id': self.company_id.id,
|
|
||||||
'category_id': self.category_id.id,
|
|
||||||
'request_date': datetime.today(),
|
|
||||||
'user_id': self.env.user.id,
|
|
||||||
'indent_line': [
|
'indent_line': [
|
||||||
(0, 0, {
|
(0, 0, {
|
||||||
'name': self.product_id_3.name,
|
'name': self.product_id_3.name,
|
||||||
@ -72,31 +74,32 @@ class TestPurchaseIndent(TransactionCase):
|
|||||||
'product_qty': 5.0,
|
'product_qty': 5.0,
|
||||||
'product_uom': self.product_id_2.uom_po_id.id,
|
'product_uom': self.product_id_2.uom_po_id.id,
|
||||||
})],
|
})],
|
||||||
}
|
})
|
||||||
self.pi = self.PurchaseIndent.create(purchase_indent_vals_1)
|
|
||||||
self.pi_1 = self.PurchaseIndent.create(purchase_indent_vals_2)
|
|
||||||
self.assertTrue(
|
|
||||||
self.pi, 'Purchase Indent: no purchase indent created')
|
|
||||||
self.assertTrue(
|
|
||||||
self.pi_1, 'Purchase Indent: no purchase indent created')
|
|
||||||
|
|
||||||
for line in self.pi.indent_line:
|
self.assertTrue(
|
||||||
|
self.purchase_indent_id,
|
||||||
|
'Purchase Indent: no purchase indent created')
|
||||||
|
self.assertTrue(
|
||||||
|
self.purchase_indent_id_1,
|
||||||
|
'Purchase Indent: no purchase indent created')
|
||||||
|
|
||||||
|
for line in self.purchase_indent_id.indent_line:
|
||||||
if line.product_qty < 0:
|
if line.product_qty < 0:
|
||||||
raise Warning(_("Quantity (%s) can not be Negative!") % (
|
raise Warning(_("Quantity (%s) can not be Negative!") % (
|
||||||
formatLang(self.env, line.product_qty, digits=2)))
|
formatLang(self.env, line.product_qty, digits=2)))
|
||||||
|
|
||||||
for line in self.pi_1.indent_line:
|
for line in self.purchase_indent_id_1.indent_line:
|
||||||
if line.product_qty < 0:
|
if line.product_qty < 0:
|
||||||
raise Warning(_("Quantity (%s) can not be Negative!") % (
|
raise Warning(_("Quantity (%s) can not be Negative!") % (
|
||||||
formatLang(self.env, line.product_qty, digits=2)))
|
formatLang(self.env, line.product_qty, digits=2)))
|
||||||
|
|
||||||
self.pi.action_confirm()
|
self.purchase_indent_id.action_confirm()
|
||||||
self.pi_1.action_confirm()
|
self.purchase_indent_id_1.action_confirm()
|
||||||
|
|
||||||
requisition_id = self.Requisition_Req.create({
|
requisition_id = self.Requisition_Req.create({
|
||||||
'category_id': self.category_id.id,
|
'category_id': self.category_id.id,
|
||||||
'order_type': 'po',
|
'order_type': 'po',
|
||||||
'purchase_indent_id': self.pi.id,
|
'purchase_indent_id': self.purchase_indent_id.id,
|
||||||
})
|
})
|
||||||
requisition_id.onchange_purchase_indent_id()
|
requisition_id.onchange_purchase_indent_id()
|
||||||
requisition_id.dummy_wiz_indent_line[0].write({'requisition_qty': 5})
|
requisition_id.dummy_wiz_indent_line[0].write({'requisition_qty': 5})
|
||||||
@ -106,10 +109,15 @@ class TestPurchaseIndent(TransactionCase):
|
|||||||
for line in requisition_id.wiz_indent_line:
|
for line in requisition_id.wiz_indent_line:
|
||||||
line.write({'price_unit': 100})
|
line.write({'price_unit': 100})
|
||||||
requisition_id.action_create()
|
requisition_id.action_create()
|
||||||
|
logging.info('Successful: Purchase Order Created!')
|
||||||
|
|
||||||
|
# Cancel Purchase Order
|
||||||
|
self.purchase_indent_id.indent_history_ids[0].order_id.button_cancel()
|
||||||
|
|
||||||
requisition_id_1 = self.Requisition_Req.create({
|
requisition_id_1 = self.Requisition_Req.create({
|
||||||
'category_id': self.category_id.id,
|
'category_id': self.category_id.id,
|
||||||
'order_type': 'pa',
|
'order_type': 'pa',
|
||||||
'purchase_indent_id': self.pi_1.id,
|
'purchase_indent_id': self.purchase_indent_id_1.id,
|
||||||
'requisition_type_id': self.agreement_type_id.id,
|
'requisition_type_id': self.agreement_type_id.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -120,4 +128,4 @@ class TestPurchaseIndent(TransactionCase):
|
|||||||
for line in requisition_id_1.wiz_indent_line:
|
for line in requisition_id_1.wiz_indent_line:
|
||||||
line.write({'price_unit': 100})
|
line.write({'price_unit': 100})
|
||||||
requisition_id_1.action_create()
|
requisition_id_1.action_create()
|
||||||
logging.info('\n\nSuccessful: Purchase Agreement Created!')
|
logging.info('Successful: Purchase Agreement Created!')
|
||||||
|
@ -21,8 +21,14 @@
|
|||||||
<field name="model">purchase.requisition</field>
|
<field name="model">purchase.requisition</field>
|
||||||
<field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
|
<field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//button[@name='%(purchase_requisition.action_purchase_requisition_to_so)d']" position="replace">
|
||||||
|
<button name="%(purchase_requisition.action_purchase_requisition_to_so)d" type="action"
|
||||||
|
string="New Quotation" class="btn-primary" context="{'default_branch_id': branch_id}"
|
||||||
|
attrs="{'invisible': [('state', 'not in', ['in_progress', 'open'])]}"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='vendor_id']" position="after">
|
<xpath expr="//field[@name='vendor_id']" position="after">
|
||||||
<field name="purchase_indent_ids" widget="many2many_tags" readonly="1"/>
|
<field name="purchase_indent_ids" widget="many2many_tags" readonly="1"/>
|
||||||
|
<field name='branch_id' readonly="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//notebook/page/field/tree/field[@name='product_qty']" position="after">
|
<xpath expr="//notebook/page/field/tree/field[@name='product_qty']" position="after">
|
||||||
<field name="purchase_indent_ids" widget="many2many_tags" readonly="1"/>
|
<field name="purchase_indent_ids" widget="many2many_tags" readonly="1"/>
|
||||||
@ -41,6 +47,7 @@
|
|||||||
<field name="request_date"/>
|
<field name="request_date"/>
|
||||||
<field name="category_id"/>
|
<field name="category_id"/>
|
||||||
<field name="company_id"/>
|
<field name="company_id"/>
|
||||||
|
<field name="branch_id" groups="base_branch_company.group_multi_branch"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
@ -53,7 +60,7 @@
|
|||||||
<form string="Purchase Indent">
|
<form string="Purchase Indent">
|
||||||
<header>
|
<header>
|
||||||
<button name="action_confirm" states="draft" string="Confirm" type="object" class="oe_highlight"/>
|
<button name="action_confirm" states="draft" string="Confirm" type="object" class="oe_highlight"/>
|
||||||
<button name="%(action_wiz_requisition_request)d" states="confirm,requisition" string="Create Requisition" type="action" context="{'default_purchase_indent_id': active_id, 'default_category_id': category_id}" class="oe_highlight" groups="base.group_system,purchase.group_purchase_manager"/>
|
<button name="%(action_wiz_requisition_request)d" states="confirm,requisition" string="Create Requisition" type="action" context="{'default_purchase_indent_id': active_id, 'default_category_id': category_id, 'default_branch_id': branch_id}" class="oe_highlight" groups="base.group_system,purchase.group_purchase_manager"/>
|
||||||
<button name="action_cancel" states="confirm" string="Cancel" type="object"/>
|
<button name="action_cancel" states="confirm" string="Cancel" type="object"/>
|
||||||
<button name="button_draft" states="cancel" string="Set to Draft" type="object"/>
|
<button name="button_draft" states="cancel" string="Set to Draft" type="object"/>
|
||||||
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,requisition,done" readonly="1"/>
|
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,requisition,done" readonly="1"/>
|
||||||
@ -75,6 +82,7 @@
|
|||||||
<field name="request_date" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
<field name="request_date" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||||
<field name="company_id" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}" required="1"/>
|
<field name="company_id" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}" required="1"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
|
<field name="branch_id" groups="base_branch_company.group_multi_branch" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||||
<field name="picking_type_id" domain="[('code','=','incoming')]" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
|
<field name="picking_type_id" domain="[('code','=','incoming')]" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
|
||||||
<field name="dest_address_id" groups="stock.group_stock_multi_locations" attrs="{'invisible': [('default_location_dest_id_usage', '!=', 'customer')], 'required': [('default_location_dest_id_usage', '=', 'customer')]}"/>
|
<field name="dest_address_id" groups="stock.group_stock_multi_locations" attrs="{'invisible': [('default_location_dest_id_usage', '!=', 'customer')], 'required': [('default_location_dest_id_usage', '=', 'customer')]}"/>
|
||||||
<field name="default_location_dest_id_usage" invisible="1"/>
|
<field name="default_location_dest_id_usage" invisible="1"/>
|
||||||
@ -94,7 +102,7 @@
|
|||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page string="History">
|
<page string="History">
|
||||||
<field name="intend_history_ids" readonly="1">
|
<field name="indent_history_ids" readonly="1">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<field name="product_id"/>
|
<field name="product_id"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
@ -127,6 +135,7 @@
|
|||||||
<field name="name" string="Name" filter_domain="[('name','ilike',self)]"/>
|
<field name="name" string="Name" filter_domain="[('name','ilike',self)]"/>
|
||||||
<field name="category_id" string="Category" filter_domain="[('category_id','ilike',self)]"/>
|
<field name="category_id" string="Category" filter_domain="[('category_id','ilike',self)]"/>
|
||||||
<field name="user_id" string="Requestd By" filter_domain="[('user_id','ilike',self)]"/>
|
<field name="user_id" string="Requestd By" filter_domain="[('user_id','ilike',self)]"/>
|
||||||
|
<field name="branch_id" string="Branch" filter_domain="[('branch_id','ilike',self)]"/>
|
||||||
<field name="state" string="State" filter_domain="[('state','ilike',self)]"/>
|
<field name="state" string="State" filter_domain="[('state','ilike',self)]"/>
|
||||||
<filter name="draft" string="Draft" domain="[('state','=', 'draft')]"/>
|
<filter name="draft" string="Draft" domain="[('state','=', 'draft')]"/>
|
||||||
<filter name="confirm" string="Confirm" domain="[('state','=','confirm')]"/>
|
<filter name="confirm" string="Confirm" domain="[('state','=','confirm')]"/>
|
||||||
@ -135,6 +144,7 @@
|
|||||||
<filter name="cancel" string="Cancel" domain="[('state', '=', 'cancel')]"/>
|
<filter name="cancel" string="Cancel" domain="[('state', '=', 'cancel')]"/>
|
||||||
<group expand="0" string="Group By">
|
<group expand="0" string="Group By">
|
||||||
<filter string="Category" domain="[]" context="{'group_by':'category_id'}"/>
|
<filter string="Category" domain="[]" context="{'group_by':'category_id'}"/>
|
||||||
|
<filter string="Branch" domain="[]" context="{'group_by':'branch_id'}"/>
|
||||||
<filter string="State" domain="[]" context="{'group_by':'state'}"/>
|
<filter string="State" domain="[]" context="{'group_by':'state'}"/>
|
||||||
<filter string="Requestd By" domain="[]" context="{'group_by':'user_id'}"/>
|
<filter string="Requestd By" domain="[]" context="{'group_by':'user_id'}"/>
|
||||||
<filter string="Request Date" domain="[]" context="{'group_by':'request_date'}"/>
|
<filter string="Request Date" domain="[]" context="{'group_by':'request_date'}"/>
|
||||||
|
@ -13,6 +13,7 @@ class WizRequisitionRequest(models.TransientModel):
|
|||||||
_name = 'wiz.requisition.request'
|
_name = 'wiz.requisition.request'
|
||||||
|
|
||||||
purchase_indent_id = fields.Many2one('purchase.indent', 'Purchase Indent')
|
purchase_indent_id = fields.Many2one('purchase.indent', 'Purchase Indent')
|
||||||
|
branch_id = fields.Many2one('res.branch', string='Branch')
|
||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one(
|
||||||
'res.partner', 'Vendor', domain="[('supplier','=',True)]")
|
'res.partner', 'Vendor', domain="[('supplier','=',True)]")
|
||||||
wiz_indent_line = fields.One2many(
|
wiz_indent_line = fields.One2many(
|
||||||
@ -47,6 +48,7 @@ class WizRequisitionRequest(models.TransientModel):
|
|||||||
purchase_indent_ids = self.purchase_indent_id.search([
|
purchase_indent_ids = self.purchase_indent_id.search([
|
||||||
('category_id', '=', self.purchase_indent_id.category_id.id),
|
('category_id', '=', self.purchase_indent_id.category_id.id),
|
||||||
('state', 'in', ['confirm', 'requisition']),
|
('state', 'in', ['confirm', 'requisition']),
|
||||||
|
('branch_id', '=', self.purchase_indent_id.branch_id.id),
|
||||||
('company_id', '=', self.purchase_indent_id.company_id.id)])
|
('company_id', '=', self.purchase_indent_id.company_id.id)])
|
||||||
list_data = []
|
list_data = []
|
||||||
value = {}
|
value = {}
|
||||||
@ -179,14 +181,17 @@ class WizRequisitionRequest(models.TransientModel):
|
|||||||
vals = {
|
vals = {
|
||||||
'partner_id': self.partner_id.id,
|
'partner_id': self.partner_id.id,
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
|
'branch_id': self.branch_id.id,
|
||||||
'company_id': self.purchase_indent_id.company_id.id,
|
'company_id': self.purchase_indent_id.company_id.id,
|
||||||
}
|
}
|
||||||
purchase_order_id = self.env['purchase.order'].create(vals)
|
purchase_order_id = self.env['purchase.order'].with_context(
|
||||||
|
{'branch_id': self.branch_id.id}).create(vals)
|
||||||
else:
|
else:
|
||||||
vals = {
|
vals = {
|
||||||
'name': self.sudo().env['ir.sequence'].next_by_code(
|
'name': self.sudo().env['ir.sequence'].next_by_code(
|
||||||
'purchase.order.requisition') or 'New',
|
'purchase.order.requisition') or 'New',
|
||||||
'type_id': self.requisition_type_id.id,
|
'type_id': self.requisition_type_id.id,
|
||||||
|
'branch_id': self.branch_id.id,
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
'company_id': self.purchase_indent_id.company_id.id,
|
'company_id': self.purchase_indent_id.company_id.id,
|
||||||
}
|
}
|
||||||
@ -199,6 +204,7 @@ class WizRequisitionRequest(models.TransientModel):
|
|||||||
line_vals = {
|
line_vals = {
|
||||||
'product_id': current_line.product_id.id,
|
'product_id': current_line.product_id.id,
|
||||||
'product_qty': current_line.product_qty,
|
'product_qty': current_line.product_qty,
|
||||||
|
'branch_id': self.branch_id.id,
|
||||||
'purchase_indent_ids':
|
'purchase_indent_ids':
|
||||||
[(6, 0, current_line.purchase_indent_ids.ids)],
|
[(6, 0, current_line.purchase_indent_ids.ids)],
|
||||||
'purchase_indent_line_id':
|
'purchase_indent_line_id':
|
||||||
@ -271,6 +277,7 @@ class WizRequisitionRequest(models.TransientModel):
|
|||||||
purchase_indent_ids = self.purchase_indent_id.search([
|
purchase_indent_ids = self.purchase_indent_id.search([
|
||||||
('category_id', '=', self.purchase_indent_id.category_id.id),
|
('category_id', '=', self.purchase_indent_id.category_id.id),
|
||||||
('state', 'in', ['confirm', 'requisition']),
|
('state', 'in', ['confirm', 'requisition']),
|
||||||
|
('branch_id', '=', self.purchase_indent_id.branch_id.id),
|
||||||
('company_id', '=', self.purchase_indent_id.company_id.id)])
|
('company_id', '=', self.purchase_indent_id.company_id.id)])
|
||||||
for purchase_indent_id in purchase_indent_ids:
|
for purchase_indent_id in purchase_indent_ids:
|
||||||
check = False
|
check = False
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<field name="requisition_type_id"
|
<field name="requisition_type_id"
|
||||||
attrs="{'invisible': ['|', ('order_type', '!=', 'pa'), ('state', '=', 'confirm')], 'required': [('order_type', '=', 'pa')]}"
|
attrs="{'invisible': ['|', ('order_type', '!=', 'pa'), ('state', '=', 'confirm')], 'required': [('order_type', '=', 'pa')]}"
|
||||||
widget="selection"/>
|
widget="selection"/>
|
||||||
|
<field name="branch_id" invisible="1"/>
|
||||||
<field name="state" invisible="1"/>
|
<field name="state" invisible="1"/>
|
||||||
</group>
|
</group>
|
||||||
<group attrs="{'invisible': [('state', '!=', 'draft')]}">
|
<group attrs="{'invisible': [('state', '!=', 'draft')]}">
|
||||||
|
@ -121,12 +121,12 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Purchase Agreements">
|
<form string="Purchase Agreements">
|
||||||
<header>
|
<header>
|
||||||
<button name="%(action_purchase_requisition_to_so)d" type="action"
|
<!--<button name="%(action_purchase_requisition_to_so)d" type="action"-->
|
||||||
string="New Quotation"
|
<!--string="New Quotation"-->
|
||||||
attrs="{'invisible': [('state', '!=', 'open')]}"/>
|
<!--attrs="{'invisible': [('state', '!=', 'open')]}"/>-->
|
||||||
<button name="%(action_purchase_requisition_to_so)d" type="action"
|
<button name="%(action_purchase_requisition_to_so)d" type="action"
|
||||||
string="New Quotation" class="btn-primary"
|
string="New Quotation" class="btn-primary"
|
||||||
attrs="{'invisible': [('state', '!=', 'in_progress')]}"/>
|
attrs="{'invisible': [('state', 'not in', ['in_progress', 'open'])]}"/>
|
||||||
<button name="action_in_progress" states="draft" string="Confirm" type="object" class="btn-primary"/>
|
<button name="action_in_progress" states="draft" string="Confirm" type="object" class="btn-primary"/>
|
||||||
<button name="action_open" states="in_progress" string="Validate" type="object" class="btn-primary"/>
|
<button name="action_open" states="in_progress" string="Validate" type="object" class="btn-primary"/>
|
||||||
<button name="action_done" states="open" string="Done" type="object" class="btn-primary"/>
|
<button name="action_done" states="open" string="Done" type="object" class="btn-primary"/>
|
||||||
|
@ -198,7 +198,7 @@
|
|||||||
<field name="code">NY</field>
|
<field name="code">NY</field>
|
||||||
<field name="partner_id" ref="base.main_partner"/>
|
<field name="partner_id" ref="base.main_partner"/>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="branch_id" ref="base_branch_company.data_branch_1"/>
|
<field name="branch_id" ref="base_branch_company.data_branch_4"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- WA -->
|
<!-- WA -->
|
||||||
|
Loading…
Reference in New Issue
Block a user