[IMP] base: Remove customer and supplier fields from res.partner
Purpose ======= Fields `customer` and `supplier` on `res.partner` are mostly used in domains of many2x fields. Those domains can confuse end users because they don't see the partner they are looking for; and it's not obvious why. Some identified problems: 1. It can lead to duplicated partners: the user does not find the partner, so he creates a new one. 2. The user imports supplier contacts in the Contacts app, so they don't get the `supplier` flag. Then the user wants to make a purchase order, and cannot find the new suppliers in the list 3. A user removes the customer flag on a prospect, because they don't think it's a customer yet - except now they can't make a quote for that customer... Specification ============= Remove the two mentioned fields. Since fields `customer` and `supplier` have been removed, all partners are now shown in many2one dropdowns. But in some cases, not all partners are relevant or some are more likely to be relevant than others. e.g. when creating a PO, top suppliers have a higher priority than other partners. So, adapt the places where those fields were used with the new mechanism to display the searched the partners, according to the number purchase/sales orders they made. TaskID: 2031147 Co-authored-by: Yannick Tivisse <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
co-authored by
Yannick Tivisse
parent
8766f388da
commit
3e97cff779
@@ -355,9 +355,6 @@ class AccountMove(models.Model):
|
||||
if self.is_sale_document(include_receipts=True):
|
||||
if self.env['ir.config_parameter'].sudo().get_param('account.use_invoice_terms'):
|
||||
self.narration = self.company_id.invoice_terms or self.env.company.invoice_terms
|
||||
return {'domain': {'partner_id': [('customer', '=', True)]}}
|
||||
elif self.is_purchase_document(include_receipts=True):
|
||||
return {'domain': {'partner_id': [('supplier', '=', True)]}}
|
||||
|
||||
@api.onchange('invoice_line_ids')
|
||||
def _onchange_invoice_line_ids(self):
|
||||
|
||||
@@ -704,12 +704,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
'company_id': st_line.company_id.id,
|
||||
}
|
||||
if st_line.partner_id:
|
||||
if st_line.partner_id.supplier and not st_line.partner_id.customer:
|
||||
data['open_balance_account_id'] = st_line.partner_id.property_account_payable_id.id
|
||||
elif not st_line.partner_id.supplier and st_line.partner_id.customer:
|
||||
data['open_balance_account_id'] = st_line.partner_id.property_account_receivable_id.id
|
||||
else:
|
||||
data['open_balance_account_id'] = amount > 0 and st_line.partner_id.property_account_receivable_id.id or st_line.partner_id.property_account_payable_id.id
|
||||
data['open_balance_account_id'] = amount > 0 and st_line.partner_id.property_account_receivable_id.id or st_line.partner_id.property_account_payable_id.id
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<field name="name">Invoices Analysis</field>
|
||||
<field name="res_model">account.invoice.report</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="context">{'search_default_current':1, 'search_default_supplier':1, 'group_by':[], 'group_by_no_leaf':1, 'search_default_year': 1}</field>
|
||||
<field name="context">{'search_default_current':1, 'res_partner_search_mode': 'supplier', 'group_by':[], 'group_by_no_leaf':1, 'search_default_year': 1}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_report_search"/>
|
||||
<field name="help">From this report, you can have an overview of the amount invoiced from your vendors. The search tool can also be used to personalise your Invoices reports and so, match this analysis to your needs.</field>
|
||||
</record>
|
||||
@@ -109,7 +109,7 @@
|
||||
<field name="name">Invoices Analysis</field>
|
||||
<field name="res_model">account.invoice.report</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="context">{'search_default_current':1, 'search_default_customer':1, 'group_by':[], 'group_by_no_leaf':1, 'search_default_year': 1}</field>
|
||||
<field name="context">{'search_default_current':1, 'res_partner_search_mode': 'customer', 'group_by':[], 'group_by_no_leaf':1, 'search_default_year': 1}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_report_search"/>
|
||||
<field name="help">From this report, you can have an overview of the amount invoiced to your customers. The search tool can also be used to personalise your Invoices reports and so, match this analysis to your needs.</field>
|
||||
</record>
|
||||
|
||||
@@ -862,17 +862,11 @@ var StatementModel = BasicModel.extend({
|
||||
return this._rpc({
|
||||
model: 'res.partner',
|
||||
method: 'read',
|
||||
args: [partner_id, ["property_account_receivable_id", "property_account_payable_id", "customer", "supplier"]],
|
||||
args: [partner_id, ["property_account_receivable_id", "property_account_payable_id"]],
|
||||
}).then(function (result) {
|
||||
if (result.length > 0) {
|
||||
var line = self.getLine(handle);
|
||||
if (result[0]['supplier'] && !result[0]['customer']) {
|
||||
self.lines[handle].st_line.open_balance_account_id = result[0]['property_account_payable_id'][0];
|
||||
} else if (!result[0]['supplier'] && result[0]['customer']) {
|
||||
self.lines[handle].st_line.open_balance_account_id = result[0]['property_account_receivable_id'][0];
|
||||
} else {
|
||||
self.lines[handle].st_line.open_balance_account_id = line.balance.amount < 0 ? result[0]['property_account_payable_id'][0] : result[0]['property_account_receivable_id'][0];
|
||||
}
|
||||
self.lines[handle].st_line.open_balance_account_id = line.balance.amount < 0 ? result[0]['property_account_payable_id'][0] : result[0]['property_account_receivable_id'][0];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -525,7 +525,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
|
||||
}
|
||||
return this.model.makeRecord('account.bank.statement.line', [field], {
|
||||
partner_id: {
|
||||
domain: ["|", ["is_company", "=", true], ["parent_id", "=", false], "|", ["customer", "=", true], ["supplier", "=", true]],
|
||||
domain: ["|", ["is_company", "=", true], ["parent_id", "=", false]],
|
||||
options: {
|
||||
no_open: true
|
||||
}
|
||||
|
||||
@@ -26,23 +26,21 @@ var db = {
|
||||
id: {string: "ID", type: 'integer'},
|
||||
display_name: {string: "Displayed name", type: 'char'},
|
||||
image: {string: "image", type: 'integer'},
|
||||
customer: {string: "customer", type: 'boolean'},
|
||||
supplier: {string: "supplier", type: 'boolean'},
|
||||
parent_id: {string: "Parent", type: 'boolean'},
|
||||
is_company: {string: "Is company", type: 'boolean'},
|
||||
property_account_receivable_id: {string: 'Account receivable', type: 'many2one', relation: 'account.account'},
|
||||
property_account_payable_id: {string: 'Account payable', type: 'many2one', relation: 'account.account'},
|
||||
},
|
||||
records: [
|
||||
{id: 1, display_name: "partner 1", image: 'AAA', customer: true},
|
||||
{id: 2, display_name: "partner 2", image: 'BBB', customer: true},
|
||||
{id: 3, display_name: "partner 3", image: 'CCC', customer: true},
|
||||
{id: 4, display_name: "partner 4", image: 'DDD', customer: true},
|
||||
{id: 8, display_name: "Agrolait", image: 'EEE', customer: true},
|
||||
{id: 12, display_name: "Camptocamp", image: 'FFF', supplier: true, property_account_receivable_id: 287, property_account_payable_id: 287},
|
||||
{id: 1, display_name: "partner 1", image: 'AAA'},
|
||||
{id: 2, display_name: "partner 2", image: 'BBB'},
|
||||
{id: 3, display_name: "partner 3", image: 'CCC'},
|
||||
{id: 4, display_name: "partner 4", image: 'DDD'},
|
||||
{id: 8, display_name: "Agrolait", image: 'EEE'},
|
||||
{id: 12, display_name: "Camptocamp", image: 'FFF', property_account_receivable_id: 287, property_account_payable_id: 287},
|
||||
// add more to have 'Search More' option
|
||||
{id: 98, display_name: "partner 98", image: 'YYY', customer: true},
|
||||
{id: 99, display_name: "partner 99", image: 'ZZZ', customer: true},
|
||||
{id: 98, display_name: "partner 98", image: 'YYY'},
|
||||
{id: 99, display_name: "partner 99", image: 'ZZZ'},
|
||||
],
|
||||
mark_as_reconciled: function () {
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -41,7 +41,6 @@ class TestAccountNoChartCommon(SavepointCase):
|
||||
cls.partner_customer_usd = Partner.create({
|
||||
'name': 'Customer from the North',
|
||||
'email': 'customer.usd@north.com',
|
||||
'customer': True,
|
||||
'property_account_payable_id': cls.account_payable.id,
|
||||
'property_account_receivable_id': cls.account_receivable.id,
|
||||
})
|
||||
|
||||
@@ -549,10 +549,7 @@
|
||||
</div>
|
||||
<field name="partner_id" widget="res_partner_many2one" nolabel="1"
|
||||
context="{
|
||||
'search_default_customer': context.get('type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt'),
|
||||
'search_default_supplier': context.get('type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt'),
|
||||
'default_customer': context.get('type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt'),
|
||||
'default_supplier': context.get('type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt'),
|
||||
'res_partner_search_mode': (context.get('type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or (context.get('type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False,
|
||||
'show_address': 1, 'default_is_company': True, 'show_vat': True}"
|
||||
options='{"always_reload": True, "no_quick_create": True}'
|
||||
attrs="{
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
<group name="partner_group" invisible="context.get('active_model') == 'account.move'">
|
||||
<field name="payment_type" widget="radio"/>
|
||||
<field name="partner_type" widget="selection" attrs="{'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]}"/>
|
||||
<field name="partner_id" attrs="{'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]}" context="{'default_is_company': True, 'default_supplier': payment_type == 'outbound', 'default_customer': payment_type == 'inbound'}"/>
|
||||
<field name="partner_id" attrs="{'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]}" context="{'default_is_company': True}"/>
|
||||
</group>
|
||||
<group name="right_column">
|
||||
<field name="communication"/>
|
||||
|
||||
@@ -579,8 +579,7 @@ action = model.setting_init_bank_account_action()
|
||||
<field name="date" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="name" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="partner_id" domain="['|',('parent_id','=',False),('is_company','=',True)]"
|
||||
context="{'default_supplier': 1}"
|
||||
attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="ref" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }" groups="base.group_no_one"/>
|
||||
<field name="amount" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="journal_currency_id" invisible="1"/>
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button type="object" class="oe_stat_button" icon="fa-pencil-square-o" name="action_view_partner_invoices"
|
||||
attrs="{'invisible': [('customer', '=', False)]}" context="{'default_partner_id': active_id}">
|
||||
context="{'default_partner_id': active_id}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<span class="o_stat_value">
|
||||
<field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/>
|
||||
@@ -220,10 +220,10 @@
|
||||
</group>
|
||||
</xpath>
|
||||
<group name="sale" position="inside">
|
||||
<field string="Payment Terms" name="property_payment_term_id" widget="selection" groups="account.group_account_invoice" attrs="{'invisible': [('customer','=', False)]}"/>
|
||||
<field string="Payment Terms" name="property_payment_term_id" widget="selection" groups="account.group_account_invoice"/>
|
||||
</group>
|
||||
<group name="purchase" position="inside">
|
||||
<field string="Payment Terms" name="property_supplier_payment_term_id" widget="selection" groups="account.group_account_invoice" attrs="{'invisible': [('supplier','=', False)]}"/>
|
||||
<field string="Payment Terms" name="property_supplier_payment_term_id" widget="selection" groups="account.group_account_invoice"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -144,7 +144,6 @@ class ResUsers(models.Model):
|
||||
|
||||
# create a copy of the template user (attached to a specific partner_id if given)
|
||||
values['active'] = True
|
||||
values['customer'] = True
|
||||
try:
|
||||
with self.env.cr.savepoint():
|
||||
return template_user.with_context(no_reset_password=True).copy(values)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<field name="trigger">on_write</field>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
|
||||
<field name="filter_domain">[('customer', '=', True)]</field>
|
||||
<field name="filter_domain">[('employee', '=', True)]</field>
|
||||
</record>
|
||||
|
||||
<record id="test_rule_recursive" model="base.automation">
|
||||
|
||||
@@ -84,13 +84,13 @@ class base_automation_test(common.TransactionCase):
|
||||
change on another model.
|
||||
"""
|
||||
partner = self.env.ref('base.res_partner_1')
|
||||
partner.write({'customer': False})
|
||||
partner.write({'employee': False})
|
||||
lead = self.create_lead(state='open', partner_id=partner.id)
|
||||
self.assertFalse(lead.customer, "Customer field should updated to False")
|
||||
self.assertFalse(lead.employee, "Customer field should updated to False")
|
||||
self.assertEqual(lead.user_id, self.user_root, "Responsible should not change on creation of Lead with state from 'draft' to 'open'.")
|
||||
# change partner, recompute on lead should trigger the rule
|
||||
partner.write({'customer': True})
|
||||
self.assertTrue(lead.customer, "Customer field should updated to True")
|
||||
partner.write({'employee': True})
|
||||
self.assertTrue(lead.employee, "Customer field should updated to True")
|
||||
self.assertEqual(lead.user_id, self.user_demo, "Responsible should be change on write of Lead when Customer becomes True.")
|
||||
|
||||
def test_11_recomputed_field(self):
|
||||
|
||||
@@ -17,7 +17,7 @@ class LeadTest(models.Model):
|
||||
active = fields.Boolean(default=True)
|
||||
partner_id = fields.Many2one('res.partner', string='Partner')
|
||||
date_action_last = fields.Datetime(string='Last Action', readonly=True)
|
||||
customer = fields.Boolean(related='partner_id.customer', readonly=True, store=True)
|
||||
employee = fields.Boolean(related='partner_id.employee', readonly=True, store=True)
|
||||
line_ids = fields.One2many('base.automation.line.test', 'lead_id')
|
||||
|
||||
priority = fields.Boolean()
|
||||
|
||||
@@ -279,7 +279,7 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" string="Opportunity Title" placeholder="e.g. Customer Deal"/>
|
||||
<field name="partner_id" widget="res_partner_many2one" domain="[('customer', '=', True)]" context="{'search_default_customer': 1, 'show_vat': True}"/>
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'res_partner_search_mode': 'customer', 'show_vat': True}"/>
|
||||
<field name="partner_name" invisible="1"/>
|
||||
<field name="street" invisible="1"/>
|
||||
<field name="street2" invisible="1"/>
|
||||
@@ -336,7 +336,7 @@
|
||||
<form>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="partner_id" widget="res_partner_many2one" domain="[('customer', '=', True)]" context="{'search_default_customer': 1, 'show_vat': True}"/>
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'res_partner_search_mode': 'customer', 'show_vat': True}"/>
|
||||
<field name="planned_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
|
||||
<field name="company_currency" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
@@ -565,8 +565,8 @@
|
||||
<group>
|
||||
<field name="partner_id"
|
||||
widget="res_partner_many2one"
|
||||
string="Customer" domain="[('customer', '=', True)]"
|
||||
context="{'search_default_customer': 1,
|
||||
string="Customer"
|
||||
context="{'res_partner_search_mode': 'customer',
|
||||
'default_name': contact_name or partner_name,
|
||||
'default_street': street,
|
||||
'default_is_company': contact_name == False,
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
<data>
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button o_res_partner_tip_opp" type="action"
|
||||
attrs="{'invisible': [('customer', '=', False)]}"
|
||||
name="%(crm.crm_lead_opportunities)d"
|
||||
icon="fa-star"
|
||||
groups="sales_team.group_sale_salesman"
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<group name="action" attrs="{'invisible': [('name', '!=', 'convert')]}" string="Customer" col="1">
|
||||
<field name="action" nolabel="1" widget="radio"/>
|
||||
<group col="2">
|
||||
<field name="partner_id" widget="res_partner_many2one" domain="[('customer', '=', True)]" context="{'search_default_customer': 1, 'show_vat': True}" attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"/>
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'res_partner_search_mode': 'customer', 'show_vat': True}" attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="inherit_id" ref="base.view_partner_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='sales_purchases']//field[@name='user_id']" position="after">
|
||||
<field name="property_delivery_carrier_id" attrs="{'invisible': [('customer','=', False)]}"/>
|
||||
<field name="property_delivery_carrier_id"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -308,9 +308,9 @@ class FleetVehicleLogFuel(models.Model):
|
||||
|
||||
liter = fields.Float()
|
||||
price_per_liter = fields.Float()
|
||||
purchaser_id = fields.Many2one('res.partner', 'Purchaser', domain="['|',('customer','=',True),('employee','=',True)]")
|
||||
purchaser_id = fields.Many2one('res.partner', 'Purchaser')
|
||||
inv_ref = fields.Char('Invoice Reference', size=64)
|
||||
vendor_id = fields.Many2one('res.partner', 'Vendor', domain="[('supplier','=',True)]")
|
||||
vendor_id = fields.Many2one('res.partner', 'Vendor')
|
||||
notes = fields.Text()
|
||||
cost_id = fields.Many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade')
|
||||
# we need to keep this field as a related with store=True because the graph view doesn't support
|
||||
@@ -360,9 +360,9 @@ class FleetVehicleLogServices(models.Model):
|
||||
})
|
||||
return res
|
||||
|
||||
purchaser_id = fields.Many2one('res.partner', 'Purchaser', domain="['|',('customer','=',True),('employee','=',True)]")
|
||||
purchaser_id = fields.Many2one('res.partner', 'Purchaser')
|
||||
inv_ref = fields.Char('Invoice Reference')
|
||||
vendor_id = fields.Many2one('res.partner', 'Vendor', domain="[('supplier','=',True)]")
|
||||
vendor_id = fields.Many2one('res.partner', 'Vendor')
|
||||
# we need to keep this field as a related with store=True because the graph view doesn't support
|
||||
# (1) to address fields from inherited table and (2) fields that aren't stored in database
|
||||
cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True, readonly=False)
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="ins_ref"/>
|
||||
<field name="cost_subtype_id" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
|
||||
<field name="insurer_id" context="{'default_supplier': True}"/>
|
||||
<field name="insurer_id"/>
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<group string="Vehicle Informations">
|
||||
@@ -425,7 +425,7 @@
|
||||
<field name="date" />
|
||||
<field name="purchaser_id" />
|
||||
<field name="inv_ref" />
|
||||
<field name="vendor_id" context="{'default_supplier': True}"/>
|
||||
<field name="vendor_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="notes" placeholder="Write here any other information"/>
|
||||
@@ -549,7 +549,7 @@
|
||||
<group string="Additional Details">
|
||||
<field name="date" />
|
||||
<field name="purchaser_id" />
|
||||
<field name="vendor_id" context="{'default_supplier': True}"/>
|
||||
<field name="vendor_id"/>
|
||||
<field name="inv_ref" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -448,7 +448,6 @@ class GoogleCalendar(models.AbstractModel):
|
||||
if not attendee:
|
||||
data = {
|
||||
'email': partner_email,
|
||||
'customer': False,
|
||||
'name': google_attendee.get("displayName", False) or partner_email
|
||||
}
|
||||
attendee = ResPartner.create(data)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<record id="filter_partner" model="ir.filters">
|
||||
<field name="name">Customer</field>
|
||||
<field name="model_id">res.partner</field>
|
||||
<field name="domain">[['customer', '=', 1]]</field>
|
||||
<field name="user_id" eval="False" />
|
||||
</record>
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
<record id="res_partner_address_fp" model="res.partner">
|
||||
<field name="name">Pieter Parter's Farm</field>
|
||||
<field name="parent_id" eval="ref('base.partner_root')"/>
|
||||
<field name="supplier">1</field>
|
||||
<field name="street">Chaussée de Namur, 40</field>
|
||||
<field name="zip">1367</field>
|
||||
<field name="city">Grand-Rosière-Hottomont</field>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="partner_id" required="1" context="{'default_is_company': True, 'default_supplier': True}"/>
|
||||
<field name="partner_id" required="1" context="{'default_is_company': True}"/>
|
||||
<field name="journal_id" widget="selection"/>
|
||||
<field name="hide_payment_method" invisible="1"/>
|
||||
<field name="payment_method_id" widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
|
||||
|
||||
@@ -14,7 +14,6 @@ class TestCommonTimesheet(TransactionCase):
|
||||
self.partner = self.env['res.partner'].create({
|
||||
'name': 'Customer Task',
|
||||
'email': 'customer@task.com',
|
||||
'customer': True,
|
||||
})
|
||||
|
||||
self.analytic_account = self.env['account.analytic.account'].create({
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<record id="res_partner_registered_customer" model="res.partner">
|
||||
<field name="name">Registered Customer</field>
|
||||
<field eval="[(6, 0, [ref('l10n_in.res_partner_category_registered')])]" name="category_id"/>
|
||||
<field name="customer">1</field>
|
||||
<field name="is_company">1</field>
|
||||
<field name="street">201, Second Floor, IT Tower 4</field>
|
||||
<field name="street2">InfoCity Gate - 1, Infocity</field>
|
||||
@@ -62,8 +61,6 @@
|
||||
<record id="res_partner_registered_supplier" model="res.partner">
|
||||
<field name="name">Registered Supplier</field>
|
||||
<field eval="[(6, 0, [ref('l10n_in.res_partner_category_registered')])]" name="category_id"/>
|
||||
<field name="customer">0</field>
|
||||
<field name="supplier">1</field>
|
||||
<field name="is_company">1</field>
|
||||
<field name="street">201, Second Floor, IT Tower 4</field>
|
||||
<field name="street2">InfoCity Gate - 1, Infocity</field>
|
||||
@@ -78,8 +75,6 @@
|
||||
<record id="res_partner_unregistered_supplier" model="res.partner">
|
||||
<field name="name">Unregistered Supplier</field>
|
||||
<field eval="[(6, 0, [ref('l10n_in.res_partner_category_unregistered')])]" name="category_id"/>
|
||||
<field name="customer">0</field>
|
||||
<field name="supplier">1</field>
|
||||
<field name="street">B105, yogeshwar Tower</field>
|
||||
<field name="city">Veraval</field>
|
||||
<field name="zip">362266</field>
|
||||
@@ -92,8 +87,6 @@
|
||||
<field name="name">Reseller(E-Commerce)</field>
|
||||
<field eval="[(6, 0, [ref('l10n_in.res_partner_category_reseller'),
|
||||
ref('l10n_in.res_partner_category_registered')])]" name="category_id"/>
|
||||
<field name="customer">0</field>
|
||||
<field name="supplier">0</field>
|
||||
<field name="street">4/001 Ground Floor, 16th Main Rd,</field>
|
||||
<field name="city">Bengaluru</field>
|
||||
<field name="zip">560001</field>
|
||||
|
||||
@@ -124,7 +124,7 @@ class MaintenanceEquipment(models.Model):
|
||||
owner_user_id = fields.Many2one('res.users', string='Owner', tracking=True)
|
||||
category_id = fields.Many2one('maintenance.equipment.category', string='Equipment Category',
|
||||
tracking=True, group_expand='_read_group_category_ids')
|
||||
partner_id = fields.Many2one('res.partner', string='Vendor', domain="[('supplier', '=', 1)]")
|
||||
partner_id = fields.Many2one('res.partner', string='Vendor')
|
||||
partner_ref = fields.Char('Vendor Reference')
|
||||
location = fields.Char('Location')
|
||||
model = fields.Char('Model')
|
||||
|
||||
@@ -368,7 +368,7 @@
|
||||
<page string="Product Information">
|
||||
<group>
|
||||
<group>
|
||||
<field name="partner_id" context="{'default_supplier': True, 'default_customer': False}"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="partner_ref"/>
|
||||
<field name="model"/>
|
||||
<field name="serial_no"/>
|
||||
|
||||
@@ -354,8 +354,6 @@ class MassMailing(models.Model):
|
||||
mailing_domain.append(('list_ids', 'in', self.contact_list_ids.ids))
|
||||
else:
|
||||
mailing_domain.append((0, '=', 1))
|
||||
elif self.mailing_model_name == 'res.partner':
|
||||
mailing_domain.append(('customer', '=', True))
|
||||
elif 'opt_out' in self.env[self.mailing_model_name]._fields and not self.mailing_domain:
|
||||
mailing_domain.append(('opt_out', '=', False))
|
||||
else:
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
<field name="category_id"/>
|
||||
<field name="membership_start" invisible="1"/>
|
||||
<field name="membership_stop" string="End Membership Date"/>
|
||||
<filter string="Customers" name="customer" domain="[('customer','=',True)]"/>
|
||||
<separator/>
|
||||
<filter string="Vendors" name="supplier" domain="[('supplier','=',True)]"/>
|
||||
<separator/>
|
||||
<filter name="all_non_members" domain="[('membership_state', 'in', ['none','canceled','old','waiting'])]" string="All non Members" help="None/Canceled/Old/Waiting"/>
|
||||
<filter name="all_members" domain="[('membership_state', 'in', ['invoiced','paid','free'])]" string="All Members" help="Invoiced/Paid/Free"/>
|
||||
|
||||
@@ -305,8 +305,6 @@ class TestKitPicking(common.TestMrpCommon):
|
||||
# We create an 'immediate transfer' receipt for x3 kit_parent
|
||||
self.test_partner = self.env['res.partner'].create({
|
||||
'name': 'Notthat Guyagain',
|
||||
'supplier': True,
|
||||
'customer': True,
|
||||
})
|
||||
self.test_supplier = self.env['stock.location'].create({
|
||||
'name': 'supplier',
|
||||
|
||||
@@ -210,7 +210,6 @@ exports.PosModel = Backbone.Model.extend({
|
||||
fields: ['name','street','city','state_id','country_id','vat',
|
||||
'phone','zip','mobile','email','barcode','write_date',
|
||||
'property_account_position_id','property_product_pricelist'],
|
||||
domain: [['customer','=',true]],
|
||||
loaded: function(self,partners){
|
||||
self.partners = partners;
|
||||
self.db.add_partners(partners);
|
||||
@@ -587,7 +586,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
},
|
||||
|
||||
prepare_new_partners_domain: function(){
|
||||
return [['customer','=',true], ['write_date','>', this.db.get_partner_write_date()]];
|
||||
return [['write_date','>', this.db.get_partner_write_date()]];
|
||||
},
|
||||
|
||||
// reload the list of partner, returns as a promise that resolves if there were
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<field name="date_order"/>
|
||||
<field name="session_id" />
|
||||
<field string="User" name="user_id"/>
|
||||
<field name="partner_id" domain="[('customer', '=', True)]" context="{'search_default_customer':1}" attrs="{'readonly': [('state','=','invoiced')]}"/>
|
||||
<field name="partner_id" context="{'res_partner_search_mode': 'customer'}" attrs="{'readonly': [('state','=','invoiced')]}"/>
|
||||
<field name="fiscal_position_id" options="{'no_create': True}"/>
|
||||
<field name="invoice_group" invisible="1"/>
|
||||
</group>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" type="action" name="%(point_of_sale.action_pos_pos_form)d"
|
||||
context="{'search_default_partner_id': active_id,'default_partner_id': active_id}"
|
||||
attrs="{'invisible': ['|', ('customer', '=', False), ('pos_order_count', '=', 0)]}"
|
||||
attrs="{'invisible': [('pos_order_count', '=', 0)]}"
|
||||
icon="fa-shopping-bag">
|
||||
<field string="PoS Orders" name="pos_order_count" widget="statinfo"/>
|
||||
</button>
|
||||
|
||||
@@ -767,7 +767,7 @@ class SupplierInfo(models.Model):
|
||||
|
||||
name = fields.Many2one(
|
||||
'res.partner', 'Vendor',
|
||||
domain=[('supplier', '=', True)], ondelete='cascade', required=True,
|
||||
ondelete='cascade', required=True,
|
||||
help="Vendor of this product")
|
||||
product_name = fields.Char(
|
||||
'Vendor Product Name',
|
||||
|
||||
@@ -630,7 +630,7 @@
|
||||
<group>
|
||||
<group name="vendor" string="Vendor">
|
||||
<field name="product_variant_count" invisible="1"/>
|
||||
<field name="name" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
|
||||
<field name="name" context="{'res_partner_search_mode': 'supplier'}"/>
|
||||
<field name="product_name"/>
|
||||
<field name="product_code"/>
|
||||
<field name="product_id" groups="product.group_product_variant" domain="[('product_tmpl_id', '=', product_tmpl_id)]" options="{'no_create_edit': True}"/>
|
||||
|
||||
@@ -29,8 +29,8 @@ class TestProductMargin(common.TransactionCase):
|
||||
get_resource_path('account', 'test', 'account_minimal_test.xml'),
|
||||
{}, 'init', False, 'test', self.registry._assertion_report)
|
||||
|
||||
supplier = self.env['res.partner'].create({'name': 'Supplier', 'supplier': True})
|
||||
customer = self.env['res.partner'].create({'name': 'Customer', 'customer': True})
|
||||
supplier = self.env['res.partner'].create({'name': 'Supplier'})
|
||||
customer = self.env['res.partner'].create({'name': 'Customer'})
|
||||
ipad = self.env.ref("product.product_product_4")
|
||||
|
||||
# Create supplier invoice and customer invoice to test product margin.
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0, 'show_vat': True}" domain="[('supplier','=',True)]"
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'res_partner_search_mode': 'supplier', 'show_vat': True}"
|
||||
placeholder="Name, TIN, Email, or Reference"
|
||||
/>
|
||||
<field name="partner_ref"/>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" name="%(purchase.act_res_partner_2_purchase_order)d" type="action"
|
||||
groups="purchase.group_purchase_user"
|
||||
attrs="{'invisible': [('supplier', '=', False)]}" icon="fa-shopping-cart">
|
||||
icon="fa-shopping-cart">
|
||||
<field string="Purchases" name="purchase_order_count" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
@@ -98,7 +98,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" name="%(purchase.act_res_partner_2_supplier_invoices)d" type="action"
|
||||
attrs="{'invisible': [('supplier', '=', False)]}" icon="fa-pencil-square-o" help="Vendor Bills">
|
||||
icon="fa-pencil-square-o" help="Vendor Bills">
|
||||
<field string="Vendor Bills" name="supplier_invoice_count" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
<field name="is_quantity_copy" invisible='1'/>
|
||||
<field name="user_id" attrs="{'readonly': [('state','not in',('draft','in_progress','open'))]}"/>
|
||||
<field name="type_id" attrs="{'readonly': [('state','!=','draft')]}" widget="selection"/>
|
||||
<field name="vendor_id" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0}" domain="[('supplier','=',True)]" attrs="{'required': [('is_quantity_copy', '=', 'none')], 'readonly': [('state', 'in', ['ongoing','done'])]}"/>
|
||||
<field name="vendor_id" context="{'res_partner_search_mode': 'supplier'}" attrs="{'required': [('is_quantity_copy', '=', 'none')], 'readonly': [('state', 'in', ['ongoing','done'])]}"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="is_quantity_copy" invisible="1"/>
|
||||
<field name="partner_id" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0}" domain="[('supplier','=',True)]" attrs="{'readonly': ['|', ('is_quantity_copy', '=', 'none'), ('state', 'in', ['purchase', 'done', 'cancel'])]}" force_save="1"/>
|
||||
<field name="partner_id" context="{'res_partner_search_mode': 'supplier'}" attrs="{'readonly': ['|', ('is_quantity_copy', '=', 'none'), ('state', 'in', ['purchase', 'done', 'cancel'])]}" force_save="1"/>
|
||||
</field>
|
||||
<field name="partner_ref" position="after">
|
||||
<field name="requisition_id" domain="[('state', 'in', ('in_progress', 'open', 'ongoing')), ('vendor_id', 'in', (partner_id, False))]"/>
|
||||
|
||||
@@ -6,7 +6,7 @@ from odoo.addons.stock.tests.common import TestStockCommon
|
||||
class TestReplenishWizard(TestStockCommon):
|
||||
def setUp(self):
|
||||
super(TestReplenishWizard, self).setUp()
|
||||
self.vendor = self.env['res.partner'].create(dict(name='The Replenisher', supplier=True))
|
||||
self.vendor = self.env['res.partner'].create(dict(name='The Replenisher'))
|
||||
self.product1_price = 500
|
||||
|
||||
# Create a supplier info witch the previous vendor
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" type="action" name="%(sale.act_res_partner_2_sale_order)d"
|
||||
groups="sales_team.group_sale_salesman"
|
||||
attrs="{'invisible': [('customer', '=', False)]}"
|
||||
icon="fa-usd">
|
||||
<field string="Sales" name="sale_order_count" widget="statinfo"/>
|
||||
</button>
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="partner_id" widget="res_partner_many2one" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1, 'show_vat': True}" options='{"always_reload": True}'/>
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'res_partner_search_mode': 'customer', 'show_address': 1, 'show_vat': True}" options='{"always_reload": True}'/>
|
||||
<field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}" options='{"always_reload": True}'/>
|
||||
<field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}" options='{"always_reload": True}'/>
|
||||
</group>
|
||||
|
||||
@@ -20,7 +20,6 @@ class TestSaleCouponCommon(TestSaleProductAttributeValueSetup):
|
||||
# create partner for sale order.
|
||||
self.steve = self.env['res.partner'].create({
|
||||
'name': 'Steve Bucknor',
|
||||
'customer': True,
|
||||
'email': 'steve.bucknor@example.com',
|
||||
})
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ class TestSaleCouponProgramNumbers(TestSaleCouponCommon):
|
||||
self.littleServer = self.env.ref('product.consu_delivery_02')
|
||||
self.steve = self.env['res.partner'].create({
|
||||
'name': 'Steve Bucknor',
|
||||
'customer': True,
|
||||
'email': 'steve.bucknor@example.com',
|
||||
})
|
||||
self.empty_order = self.env['sale.order'].create({
|
||||
|
||||
@@ -35,7 +35,6 @@ class TestCommonSalePurchaseNoChart(TestCommonSaleNoChart):
|
||||
cls.partner_vendor_service = cls.env['res.partner'].create({
|
||||
'name': 'Super Service Supplier',
|
||||
'email': 'supplier.serv@supercompany.com',
|
||||
'supplier': True,
|
||||
})
|
||||
|
||||
cls.service_purchase_1 = cls.env['product.product'].create({
|
||||
|
||||
@@ -22,7 +22,6 @@ class TestProjectBilling(TestCommonSaleTimesheetNoChart):
|
||||
cls.partner_2 = cls.env['res.partner'].create({
|
||||
'name': 'Customer from the South',
|
||||
'email': 'customer.usd@south.com',
|
||||
'customer': True,
|
||||
'property_account_payable_id': cls.account_payable.id,
|
||||
'property_account_receivable_id': cls.account_receivable.id,
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ class ProjectCreateSalesOrder(models.TransientModel):
|
||||
return result
|
||||
|
||||
project_id = fields.Many2one('project.project', "Project", domain=[('sale_line_id', '=', False)], help="Project for which we are creating a sales order", required=True)
|
||||
partner_id = fields.Many2one('res.partner', string="Customer", domain=[('customer', '=', True)], required=True, help="Customer of the sales order")
|
||||
partner_id = fields.Many2one('res.partner', string="Customer", required=True, help="Customer of the sales order")
|
||||
product_id = fields.Many2one('product.product', domain=[('type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.")
|
||||
price_unit = fields.Float("Unit Price", help="Unit price of the sales order item.")
|
||||
currency_id = fields.Many2one('res.currency', string="Currency", related='product_id.currency_id', readonly=False)
|
||||
|
||||
@@ -135,8 +135,6 @@
|
||||
<!-- Child Company 1-->
|
||||
<record id="res_partner_company_1" model="res.partner">
|
||||
<field name="name">My Company, Chicago</field>
|
||||
<field eval="1" name="customer"/>
|
||||
<field eval="1" name="supplier"/>
|
||||
<field name="is_company">1</field>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="street">90 Streets Avenue</field>
|
||||
|
||||
@@ -125,8 +125,6 @@ class ValuationReconciliationTestCase(AccountingTestCase):
|
||||
|
||||
self.test_partner = self.env['res.partner'].create({
|
||||
'name': 'Ruben Rybnik',
|
||||
'supplier': True,
|
||||
'customer': True,
|
||||
})
|
||||
|
||||
self.product_price_unit = 66.0
|
||||
|
||||
@@ -60,7 +60,6 @@ class SurveyCase(common.SavepointCase):
|
||||
self.customer = self.env['res.partner'].create({
|
||||
'name': 'Caroline Customer',
|
||||
'email': 'customer@example.com',
|
||||
'customer': True,
|
||||
})
|
||||
|
||||
self.survey = self.env['survey.survey'].with_user(self.survey_manager).create({
|
||||
|
||||
@@ -338,7 +338,7 @@ QUnit.module('fields', {}, function () {
|
||||
'<field ' +
|
||||
'name="trululu" ' +
|
||||
'string="custom label" ' +
|
||||
'context="{\'search_default_customer\':1, \'show_address\': 1}" ' +
|
||||
'context="{\'show_address\': 1}" ' +
|
||||
'options="{\'always_reload\': True}"' +
|
||||
'/>' +
|
||||
'</group>' +
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//group[@name='sale']" position="inside">
|
||||
<field name="assigned_partner_id" groups="base.group_no_one" attrs="{'invisible': [('customer','=', False)]}"/>
|
||||
<field name="assigned_partner_id" groups="base.group_no_one"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
@@ -635,7 +635,6 @@ class WebsiteSale(http.Controller):
|
||||
if k not in ('field_required', 'partner_id', 'callback', 'submitted'): # classic case
|
||||
_logger.debug("website_sale postprocess: %s value has been dropped (empty or not writable)" % k)
|
||||
|
||||
new_values['customer'] = True
|
||||
new_values['team_id'] = request.website.salesteam_id and request.website.salesteam_id.id
|
||||
new_values['user_id'] = request.website.salesperson_id and request.website.salesperson_id.id
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class SlidesCase(common.SavepointCase):
|
||||
self.customer = self.env['res.partner'].create({
|
||||
'name': 'Caroline Customer',
|
||||
'email': 'customer@example.com',
|
||||
'customer': True,
|
||||
})
|
||||
|
||||
self.channel = self.env['slide.channel'].with_user(self.user_publisher).create({
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<record id="main_partner" model="res.partner" context="{'default_is_company': True}">
|
||||
<field name="name">My Company</field>
|
||||
<field name="company_id" eval="None"/>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="is_company" eval="True"/>
|
||||
<field name="street"></field>
|
||||
<field name="city"></field>
|
||||
@@ -18,7 +17,6 @@
|
||||
<record model="res.partner" id="base.partner_root">
|
||||
<field name="name">System</field>
|
||||
<field name="company_id" ref="main_company"/>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="email">root@example.com</field>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
@@ -26,7 +24,6 @@
|
||||
<record model="res.partner" id="base.partner_admin">
|
||||
<field name="name">Administrator</field>
|
||||
<field name="company_id" ref="main_company"/>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="email">admin@example.com</field>
|
||||
<field name="image" type="base64" file="base/static/img/avatar_grey.png"/>
|
||||
</record>
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
<record id="res_partner_1" model="res.partner">
|
||||
<field name="name">Wood Corner</field>
|
||||
<field eval="[(6, 0, [ref('res_partner_category_14'), ref('res_partner_category_12')])]" name="category_id"/>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
<field name="is_company">1</field>
|
||||
<field name="street">1164 Cambridge Drive</field>
|
||||
<field name="city">White Tanks</field>
|
||||
@@ -71,7 +69,6 @@
|
||||
</record>
|
||||
<record id="res_partner_3" model="res.partner">
|
||||
<field name="name">Gemini Furniture</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="[(6, 0, [ref('res_partner_category_8'), ref('res_partner_category_14')])]" name="category_id"/>
|
||||
<field name="is_company">1</field>
|
||||
<field name="street">1128 Lunetta Street</field>
|
||||
@@ -88,8 +85,6 @@
|
||||
<record id="res_partner_4" model="res.partner">
|
||||
<field name="name">Ready Mat</field>
|
||||
<field eval="[(6, 0, [ref('res_partner_category_14'), ref('res_partner_category_12')])]" name="category_id"/>
|
||||
<field eval="0" name="customer"/>
|
||||
<field eval="1" name="supplier"/>
|
||||
<field name="is_company">1</field>
|
||||
<field name="street">92 Emily Drive</field>
|
||||
<field name="city">Columbia</field>
|
||||
@@ -118,8 +113,6 @@
|
||||
<record id="res_partner_12" model="res.partner">
|
||||
<field name="name">Azure Interior</field>
|
||||
<field eval="[(6, 0, [ref('res_partner_category_11')])]" name="category_id"/>
|
||||
<field name="supplier">1</field>
|
||||
<field name="customer">1</field>
|
||||
<field name="is_company">1</field>
|
||||
<field name="street">3404 Edgewood Road</field>
|
||||
<field name="city">Jonesboro</field>
|
||||
@@ -152,8 +145,6 @@
|
||||
<field name="function">Service Manager</field>
|
||||
<field name="email">willie.burke80@example.com</field>
|
||||
<field name="phone">(846)-523-2111</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="res_partner_address_2" model="res.partner">
|
||||
<field name="name">Ron Gibson</field>
|
||||
@@ -161,8 +152,6 @@
|
||||
<field name="function">Store Manager</field>
|
||||
<field name="email">ron.gibson76@example.com</field>
|
||||
<field name="phone">(976)-397-4091</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="res_partner_address_3" model="res.partner">
|
||||
<field name="name">Douglas Fletcher</field>
|
||||
@@ -191,8 +180,6 @@
|
||||
<field name="function">Production Supervisor</field>
|
||||
<field name="email">billy.fox45@example.com</field>
|
||||
<field name="phone">(915)-498-5611</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="res_partner_address_10" model="res.partner">
|
||||
<field name="name">Jesse Brown</field>
|
||||
@@ -268,10 +255,8 @@
|
||||
<field name="name">Tom Ruiz</field>
|
||||
<field name="parent_id" eval="ref('res_partner_1')"/>
|
||||
<field name="function">Software Developer</field>
|
||||
<field name="supplier">1</field>
|
||||
<field name="email">tom.ruiz89@example.com</field>
|
||||
<field name="phone">(102)-834-1602</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="res_partner_address_28" model="res.partner">
|
||||
<field name="name">Colleen Diaz</field>
|
||||
@@ -293,8 +278,6 @@
|
||||
<field name="function">Sales Representative</field>
|
||||
<field name="email">addison.olson28@example.com</field>
|
||||
<field name="phone">(223)-399-7637</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="res_partner_address_32" model="res.partner">
|
||||
<field name="name">Sandra Neal</field>
|
||||
@@ -321,14 +304,12 @@
|
||||
<field name="name">Chester Reed</field>
|
||||
<field name="parent_id" eval="ref('main_partner')"/>
|
||||
<field name="function">Chief Executive Officer (CEO)</field>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="email">chester.reed79@example.com</field>
|
||||
<field name="phone">(979)-904-8902</field>
|
||||
</record>
|
||||
<record id="res_partner_main2" model="res.partner">
|
||||
<field name="name">Dwayne Newman</field>
|
||||
<field name="function">Chief Operations Officer (COO)</field>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="parent_id" eval="ref('main_partner')"/>
|
||||
<field name="email">dwayne.newman28@example.com</field>
|
||||
<field name="phone">(614)-177-4937</field>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<record id="partner_demo" model="res.partner">
|
||||
<field name="name">Marc Demo</field>
|
||||
<field name="company_id" ref="main_company"/>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="company_name">YourCompany</field>
|
||||
<field name="street">3575 Buena Vista Avenue</field>
|
||||
<field name="city">Eugene</field>
|
||||
@@ -64,8 +63,6 @@
|
||||
<record id="partner_demo_portal" model="res.partner">
|
||||
<field name="name">Joel Willis</field>
|
||||
<field name="email">joel.willis63@example.com</field>
|
||||
<field name="supplier" eval="False"/>
|
||||
<field name="customer" eval="True"/>
|
||||
<field name="street">858 Lynn Street</field>
|
||||
<field name="city">Bayonne</field>
|
||||
<field model="res.country.state" name="state_id" search="[('code','ilike','NJ')]"/>
|
||||
|
||||
@@ -219,7 +219,6 @@ class Company(models.Model):
|
||||
'name': vals['name'],
|
||||
'is_company': True,
|
||||
'image': vals.get('logo'),
|
||||
'customer': False,
|
||||
'email': vals.get('email'),
|
||||
'phone': vals.get('phone'),
|
||||
'website': vals.get('website'),
|
||||
|
||||
@@ -437,7 +437,7 @@ class Users(models.Model):
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
users = super(Users, self.with_context(default_customer=False)).create(vals_list)
|
||||
users = super(Users, self).create(vals_list)
|
||||
for user in users:
|
||||
user.partner_id.active = user.active
|
||||
if user.partner_id.company_id:
|
||||
|
||||
@@ -465,16 +465,16 @@ class TestAPI(common.TransactionCase):
|
||||
def test_80_filter(self):
|
||||
""" Check filter on recordsets. """
|
||||
ps = self.env['res.partner'].search([])
|
||||
customers = ps.browse([p.id for p in ps if p.customer])
|
||||
customers = ps.browse([p.id for p in ps if p.employee])
|
||||
|
||||
# filter on a single field
|
||||
self.assertEqual(ps.filtered(lambda p: p.customer), customers)
|
||||
self.assertEqual(ps.filtered('customer'), customers)
|
||||
self.assertEqual(ps.filtered(lambda p: p.employee), customers)
|
||||
self.assertEqual(ps.filtered('employee'), customers)
|
||||
|
||||
# filter on a sequence of fields
|
||||
self.assertEqual(
|
||||
ps.filtered(lambda p: p.parent_id.customer),
|
||||
ps.filtered('parent_id.customer')
|
||||
ps.filtered(lambda p: p.parent_id.employee),
|
||||
ps.filtered('parent_id.employee')
|
||||
)
|
||||
|
||||
@mute_logger('odoo.models')
|
||||
|
||||
@@ -315,7 +315,7 @@ class TestInherits(TransactionCase):
|
||||
user_foo = self.env['res.users'].create({
|
||||
'name': 'Foo',
|
||||
'login': 'foo',
|
||||
'supplier': True,
|
||||
'employee': True,
|
||||
})
|
||||
foo_before, = user_foo.read()
|
||||
del foo_before['__last_update']
|
||||
@@ -327,7 +327,7 @@ class TestInherits(TransactionCase):
|
||||
|
||||
self.assertEqual(user_bar.name, 'Foo (copy)')
|
||||
self.assertEqual(user_bar.login, 'bar')
|
||||
self.assertEqual(user_foo.supplier, user_bar.supplier)
|
||||
self.assertEqual(user_foo.employee, user_bar.employee)
|
||||
self.assertNotEqual(user_foo.id, user_bar.id)
|
||||
self.assertNotEqual(user_foo.partner_id.id, user_bar.partner_id.id)
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
<field name="parent_id"
|
||||
widget="res_partner_many2one"
|
||||
placeholder="Company"
|
||||
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'default_supplier': supplier, 'default_customer': customer, 'show_vat': True}"
|
||||
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'show_vat': True}"
|
||||
attrs="{'invisible': ['|', '&', ('is_company','=', True),('parent_id', '=', False),('company_name', '!=', False),('company_name', '!=', '')]}"/>
|
||||
<field name="company_name" attrs="{'invisible': ['|', '|', ('company_name', '=', False), ('company_name', '=', ''), ('is_company', '=', True)]}"/>
|
||||
<button name="create_company" type="object" class="oe_edit_only btn-link"
|
||||
@@ -186,8 +186,6 @@
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
<field name="email" widget="email" context="{'gravatar_image': True}"/>
|
||||
<field name="customer" invisible="1"/>
|
||||
<field name="supplier" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
@@ -222,7 +220,7 @@
|
||||
<field name="parent_id"
|
||||
widget="res_partner_many2one"
|
||||
placeholder="Company"
|
||||
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'default_supplier': supplier, 'default_customer': customer, 'show_vat': True}"
|
||||
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'show_vat': True}"
|
||||
attrs="{'invisible': ['|', '&', ('is_company','=', True),('parent_id', '=', False),('company_name', '!=', False),('company_name', '!=', '')]}"/>
|
||||
<field name="company_name" attrs="{'invisible': ['|', '|', ('company_name', '=', False), ('company_name', '=', ''), ('is_company', '=', True)]}"/>
|
||||
<button name="create_company" type="object" class="oe_edit_only btn-link"
|
||||
@@ -283,7 +281,7 @@
|
||||
|
||||
<notebook colspan="4">
|
||||
<page string="Contacts & Addresses" autofocus="autofocus">
|
||||
<field name="child_ids" mode="kanban" context="{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_supplier': supplier, 'default_customer': customer, 'default_lang': lang, 'default_user_id': user_id}">
|
||||
<field name="child_ids" mode="kanban" context="{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_lang': lang, 'default_user_id': user_id}">
|
||||
<kanban>
|
||||
<field name="id"/>
|
||||
<field name="color"/>
|
||||
@@ -306,9 +304,7 @@
|
||||
<field name="lang"/>
|
||||
<!-- fields in form x2many view to diminish requests -->
|
||||
<field name="comment"/>
|
||||
<field name="customer"/>
|
||||
<field name="display_name"/>
|
||||
<field name="supplier"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
|
||||
@@ -380,8 +376,6 @@
|
||||
<field name="image_medium" widget="image" class="oe_avatar" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="supplier" invisible="True"/>
|
||||
<field name="customer" invisible="True"/>
|
||||
<field name="lang" invisible="True"/>
|
||||
<field name="image" invisible="True"/>
|
||||
<field name="user_id" invisible="True"/>
|
||||
@@ -395,11 +389,9 @@
|
||||
<page name='sales_purchases' string="Sales & Purchase">
|
||||
<group name="container_row_2">
|
||||
<group string="Sales" name="sale" priority="1">
|
||||
<field name="customer"/>
|
||||
<field name="user_id" attrs="{'invisible': [('customer','=', False)]}"/>
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<group string="Purchase" name="purchase" priority="2">
|
||||
<field name="supplier"/>
|
||||
</group>
|
||||
<group name="misc" string="Misc">
|
||||
<field name="ref" string="Reference"/>
|
||||
@@ -474,8 +466,6 @@
|
||||
<filter string="Individuals" name="type_person" domain="[('is_company','=',False)]"/>
|
||||
<filter string="Companies" name="type_company" domain="[('is_company','=',True)]"/>
|
||||
<separator/>
|
||||
<filter string="Customers" name="customer" domain="[('customer','=',True), ('parent_id', '=', False)]"/>
|
||||
<filter string="Vendors" name="supplier" domain="[('supplier','=',True), ('parent_id', '=', False)]"/>
|
||||
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
|
||||
<separator/>
|
||||
<field name="category_id" string="Tag" filter_domain="[('category_id','child_of', self)]"/>
|
||||
@@ -559,7 +549,7 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="context">{"search_default_customer":1}</field>
|
||||
<field name="context">{'res_partner_search_mode': 'customer'}</field>
|
||||
<field name="search_view_id" ref="view_res_partner_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
@@ -594,7 +584,7 @@
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="context">{'default_customer':1, 'search_default_customer':1, 'default_is_company': True}</field>
|
||||
<field name="context">{'res_partner_search_mode': 'customer', 'default_is_company': True}</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
@@ -629,7 +619,7 @@
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="context">{'search_default_supplier': 1,'default_customer': 0,'default_supplier': 1, 'default_is_company': True}</field>
|
||||
<field name="context">{'res_partner_search_mode': 'supplier', 'default_is_company': True}</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
@@ -664,7 +654,7 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="domain">[('employee','=',1)]</field>
|
||||
<field name="context">{'default_customer':0, 'default_supplier':0 , 'default_employee':1}</field>
|
||||
<field name="context">{'default_employee':1}</field>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
[["Wood y Wood Pecker", "", "Snow Street, 25", "Kainuu", "Finland", "Vendor", "1", "0", "1", ""], ["Roger Pecker", "Contact", "Snow Street, 27", "Kainuu", "Finland", "Vendor", "1", "0", "0", "Wood y Wood Pecker"], ["Sharon Pecker", "Delivery Address", "Snow Street, 28", "Kainuu", "Finland", "Vendor", "1", "0", "0", "Wood y Wood Pecker"], ["Thomas Pecker", "Contact", "Snow Street, 27", "Kainuu", "Finland", "Vendor", "1", "0", "0", "Wood y Wood Pecker"], ["Norseman Roundabout", "", "Atonium Street, 45a", "Brussels", "Belgium", "Vendor", "1", "0", "1", ""], ["Yvan Holiday", "Invoice Address", "Atonium Street, 45b", "Brussels", "Belgium", "Vendor", "1", "0", "0", "Norseman Roundabout"], ["Jack Unsworth", "Contact", "Atonium Street, 45a", "Brussels", "Belgium", "Vendor", "1", "0", "0", "Norseman Roundabout"]]
|
||||
[["Wood y Wood Pecker", "", "Snow Street, 25", "Kainuu", "Finland", "Vendor", "1", ""], ["Roger Pecker", "Contact", "Snow Street, 27", "Kainuu", "Finland", "Vendor", "0", "Wood y Wood Pecker"], ["Sharon Pecker", "Delivery Address", "Snow Street, 28", "Kainuu", "Finland", "Vendor", "0", "Wood y Wood Pecker"], ["Thomas Pecker", "Contact", "Snow Street, 27", "Kainuu", "Finland", "Vendor", "0", "Wood y Wood Pecker"], ["Norseman Roundabout", "", "Atonium Street, 45a", "Brussels", "Belgium", "Vendor", "1", ""], ["Yvan Holiday", "Invoice Address", "Atonium Street, 45b", "Brussels", "Belgium", "Vendor", "0", "Norseman Roundabout"], ["Jack Unsworth", "Contact", "Atonium Street, 45a", "Brussels", "Belgium", "Vendor", "0", "Norseman Roundabout"]]
|
||||
|
||||
@@ -985,7 +985,7 @@ class test_realworld(common.TransactionCase):
|
||||
|
||||
def test_backlink(self):
|
||||
fnames = ["name", "type", "street", "city", "country_id", "category_id",
|
||||
"supplier", "customer", "is_company", "parent_id"]
|
||||
"is_company", "parent_id"]
|
||||
data = json.loads(pkgutil.get_data(self.__module__, 'contacts.json').decode('utf-8'))
|
||||
result = self.env['res.partner'].load(fnames, data)
|
||||
self.assertFalse(result['messages'])
|
||||
|
||||
Reference in New Issue
Block a user